Voxel lighting

Started by
3 comments, last by dimebolt 18 years, 8 months ago
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?
Advertisement
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
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...
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?
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

This topic is closed to new replies.

Advertisement