Jump to content
  • Advertisement
Sign in to follow this  
JazzD

3d texture generation

This topic is 5168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey, I'm wondering if there is a way, or I know it's possible but I don't know how :), to generate 3d opengl texture from a loaded 1D and 2D texture, i had the idea of some nice lighting effects with my 3d attenuation using grills or symbols for the 2d textures, i don't think the 1d part has to be altered, I only have to use my texture loader to load the 2d texture encode the file format and use the image data i would upload with teximage2d into the 3d texture array somehow and then send it to the teximage3d to generate the 3d texture. Any ideas :)? Would be very useful and nice-looking I bet..

Share this post


Link to post
Share on other sites
Advertisement
Since you need this for falloff/attenuation texture I sugest you don't load anything from disk. Just generate texture at runtime.
Create array of size^3 so it can hold intensity data. Then for each texel calculate distance from center. Then based on this distance calculate attenuation. I usualy use something like (1-dist^2)^2. Then send this array as texture data. Make sure you set warp mode to clamp to edge and border texels have value 0 so you don't have any wierd light/bright spots in your scene.

Share this post


Link to post
Share on other sites
hmm well im talking about something like the fan effect from doom3, or a grill effect when a light shines through a grill.

Share this post


Link to post
Share on other sites
OK, then sorry for the rambling in my last post :).
Anyways, how do you intend to use those textures with 3D ones? Use 'fan' texture and blur it in distance to simulate soft shadows or what?

Share this post


Link to post
Share on other sites
3d textures is a bad ideia for what you want to do.,
Simply project the fan\grid texture with projective texturing , and clip the back projection.

Share this post


Link to post
Share on other sites
I don't think Doom3 uses a 3D texture. It's wasting too much texture memory for such effect. I'd recommend projective texturing as Bruno did. However I wouldn't go clipping back projection unless really needed. Or you can go cubemap texturing, where you're free to encode a full light projection (not limited to a spotlight like 2D projective texturing).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!