Forum Discussion
lazydodo
13 years agoHonored Guest
Shader Optimization.
I was playing with the shader and wondered if it could be optimized. Lets start with the standard Shader float2 HmdWarp(float2 in01) { float2 theta = (in01 - LensCenter) * ScaleIn; // ...
Entroper
13 years agoHonored Guest
Nice job!
I was thinking earlier that since HmdWarpParam.w was always zero, you could leave out the r^6 term in the equation, and save yourself another two multiplies and an add (or four multiplies depending on how good the compiler is at optimization and scheduling). But this looks like it beats the pants off that little tweak anyway. :)
I wonder if you could generalize this further and avoid the dependent texture lookup. What if, instead of just drawing a single big quad, you drew a mesh of smaller quads with the right tex coords baked into the vertices? It would be an approximation, but I bet that bilinear filtering would be close enough even with a fairly sparse quad mesh. You could even pre-warp the quad mesh so that you aren't drawing the black area at all. Any thoughts?
I was thinking earlier that since HmdWarpParam.w was always zero, you could leave out the r^6 term in the equation, and save yourself another two multiplies and an add (or four multiplies depending on how good the compiler is at optimization and scheduling). But this looks like it beats the pants off that little tweak anyway. :)
I wonder if you could generalize this further and avoid the dependent texture lookup. What if, instead of just drawing a single big quad, you drew a mesh of smaller quads with the right tex coords baked into the vertices? It would be an approximation, but I bet that bilinear filtering would be close enough even with a fairly sparse quad mesh. You could even pre-warp the quad mesh so that you aren't drawing the black area at all. Any thoughts?
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 year ago