Jump to content
  • Advertisement
Sign in to follow this  
AjitG

OpenGL Voxel lighting

This topic is 4835 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

I am working on a voxel rendering program. I am using 3D texture in OpenGL and VolumeTexture in DirectX to get the same effect. I want to shade the volume data. (In other words - add light effect to the volume) This lighting has to be done using gradient vectors. (There is a gradient vector for each voxel of the volume ) I am totally clueless on how to do it. Can anyone help?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Does your hardware support fagment shading? This sort of problem is easiest to solve by writing a fragment shader. Otherwise, you'll probably need multiple passes to obtain the effect.

Tom

Share this post


Link to post
Share on other sites
Hmm, that was my reply. Don't know why it's Anonymous...

Tom

EDIT:
To elaborate a bit:
Assuming you use slices perpendicular to the viewing vector to render the voxels, your problem is similar to normal-mapping. You cannot use the normal of the slices in the lighting calculation (as they are unrelated to the data), but you need to use the gradients you calculated. Use google to find multi-pass or fragment shader algorithms to do that...

Share this post


Link to post
Share on other sites
Thanks for suggestions.
I have the accelerator card. I know using shaders we can do it, but I don't know how exactly we do it?
Can you throw some more light on the topic?

Share this post


Link to post
Share on other sites
Quote:
Original post by AjitG
Thanks for suggestions.
I have the accelerator card. I know using shaders we can do it, but I don't know how exactly we do it?
Can you throw some more light on the topic?


As I said, google reveals plenty of information on normal mapping. This gamedev article describes how to do bumpmapping using the Cg shader language (which is a good choice if you use both OpenGL and Direct3D). Bumpmapping is an application of normal mapping and is similar to what you need.

Tom

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!