The whole object produces light. How to do it&

Started by
3 comments, last by Nik02 19 years, 5 months ago
Hot to make an object (mesh) produce light? In my case it's a sphere. This sphere and surrounding objects are situated in close range. I need to make this spere produce light in all directions as if it was a sun. What should i do? What if the object is not a sphere? I suppose I have to create a lot of lights on the object's surface. But how many and would it be slow? Thanks.
Advertisement
Do you use a FX file?
If it is so it is simply...
Just insert a LightSource in the shader.

Your object must be a sphere, because the light is defined as 1 point (and/or a direction) in the space.
For geometry to truely "produce light", you have to use a radiosity solver of some degree, and store the result either with the affected vertices or in a texture.

In the special case of a sphere, you can approximate it's light emission with a point light source, though the emitter surface area isn't taken into consideration using strictly that technique. You can achieve a better approximation using multiple point lights divided as evenly as possible inside the sphere's volume.

Niko Suni

To tiger54:
No I'm not using FX file. To be quite honest about it I recently started learning Direct3D and just managed to learn the basis. And I think it would be better to seek for some tutorials about shaders instead of asking what actually FX file mean. :-)

>You can achieve a better approximation using multiple point lights divided as evenly as possible inside the sphere's volume.
Ok. I'll try this way. But it can demand a great productivity of a graphical system I suppose. And it also might look unnaturally with shadows.

And does Direct3D support "radiosity"? I've used it in 3DSMAX.







Direct3D does not support radiosity automatically, so you'd have to pre-calculate the lighting data and store it either per-pixel or per-vertex depending on the precision needed.

D3D does have helper functions to precalculate lighting conditions to spherical harmonic coefficients - one parameter of the sh equations being radiosity. However, it is difficult to pre-calculate lighting conditions if the objects move at all in relation to each other.

See the SDK for more info about spherical harmonics, if interested. It is too big a topic to compress to a single post, IMO.

-Nik

Niko Suni

This topic is closed to new replies.

Advertisement