Multiple Projected Textures

Started by
3 comments, last by InvalidPointer 14 years, 10 months ago
Hi there, I am working on a RPG type game (in DX9) which will require multiple projective textures (Spell Effects, Shadows, Target Rings and maybe more), most would be orthographic and non-wrapping. At this point I don't know the maximum number I will need however I can foresee it being quite alot. I can see two ways of rendering scenes: a) What i believe is the standard method, Render each scene passing texcoords from the VS then preforming look up in the PS. As I understand this is limited by the maximum value of n (TexCoord[n]) which the card supports and/or memory available for transformation matrices. With this I could split projection into chunks, and alpha bend additional projected textures. The disadvantage of which is I would need a separate pass for each projection which different Blend Mode or PS. b) Render the scene with no textures projected (could be optimized to include some using the above method), then build a quad which encloses pixels which 'could' be part of the projection. The PS would then project back onto the projection plane to get tex-coords. This would mean I only render the scene once no-matter the number of projections / 'effects'. However the projection needs to occur per pixel rather than vertex. So I guess the question is, am I on the right track? Which would you use? and is there another way of doing it?
Advertisement
I would just use as many render passes as needed. You can partition your rendering based on the blend modes. Of course, the more work you can cram into a single pass, the better - but there exists a critical point where the "cram" operation takes more time than the actual rendering.

If you end up rendering many complex passes, it is wise to do a z-only pass so as to fill the z-buffer. This way, you will save considerable amounts of fill rate in the subsequent passes, as invisible geometry will not cause pixel shader invocations (unless you modify the depth in PS). Also, z-only rendering is commonly twice as fast as color+depth rendering.

Niko Suni

you can calculate the projections in the pixel shader. Texture projection is pretty cheap. Use ps 3.0
Thanks guys.

I think it will be best if I go with a combination of both. I think there will be a point where the first method becomes quicker than the second (doing 8 textures parallel > doing 8 textures serial).
Consider a fullscreen texture bombing pass, as I think this could be extended to work with much, much more than the handful of effects you describe.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement