About Store Forum Documentation Contact



Post Reply 
General Lighting
Author Message
kaito Offline
Member

Post: #1
General Lighting
In the code, I use the command ambPower to illuminate the scene but not enough.
Also, add a sky and sun, but still not enough.

After, I added to a scene a LightDir and a LightPoint, even volumetric lights (volLight(true)), but the mesh shine too except the ground mesh.

The material type used in the ground was created from the Mesh Editor (was Fur Tech), and the appearance is not the same during the execution of the demo(is a flat texture, not fur).

This is the last code: <!-- m --><a class="postlink" href="http://www.speedyshare.com/849324592.html">http://www.speedyshare.com/849324592.html</a><!-- m -->

Some the code used:

Code:
void InitPre() // init before engine inits
{
   ...
   App.flag=APP_MS_EXCLUSIVE;  // setup mouse exclusive mode to hide cursor


   D.mode(1024,768,1).ambMode(AMB_HIGH1).ambPower(0.6).hdr(true).hpRt(true).hwDepth​Buffer(true).mtnMode(MTN_HIGH);

}
/******************************************************************************/
Bool Init() // init after engine inits
{
    material_fur.reset();             // setup defaults
   material_fur.load("LocalData/Obj/terreno/Terreno.tga.mtrl");
   material_fur.technique=MTECH_FUR; // set fur technique
   material_fur.det_power =2;        // in  fur technique 'det_power' is used for fur length
   material_fur.ambient.set(1);
   material_fur.det_scale*=2;        // in  fur technique 'det_scale' is used for fur scale

    // Cargar Mallas
    meshMalla1.load("LocalData/Obj/terreno/terreno.mesh");
    meshMalla1.setMaterial(&material_fur);
...
}

...

void Render()
{
   switch(Renderer()) {

...

        case RM_LIGHT:        {///////////////            ILUMINACION                         ////////////////
            LightPoint(10,player.matrix.pos+Vec(0,1,0)).add();            
            break;
                            }
                                  // since we want to render shadows we have to process additional rendering mode 'RM_SHD_MAP' (render shadows through shadow maps)
      // here we will render all meshes which cast shadows
        case RM_SHD_MAP:    {
                    player.dibujar();
                            break;
     }
   }
}

...


Regards
05-02-2009 12:28 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
Re: General Lighting
Hi,

Fur objects need to be rendered additionaly in RM_FUR rendering mode, however fur isn't supported with multiple material blending (one MeshPart that uses multiple materials)

If you want to use the Material::ambient parameter you should render the meshes also in RM_LIGHT mode.

check also your Material::color parameters
05-03-2009 03:25 PM
Find all posts by this user Quote this message in a reply
kaito Offline
Member

Post: #3
Re: General Lighting
Excuse me, I did not study correctly the tutorial Advanced\2 - Animation, Physics, Rendering\Rendering\08 - Materials.cpp
Exactly, it show RM_FUR together RM_SOLID.

Code:
...
   switch(Renderer())
   {
      case RM_FUR  : // here since fur technique is being used we must process also 'RM_FUR' mode, in it we can simply render everything which is in 'RM_SOLID' mode
      case RM_SOLID:
...

With this modification, the lighting has improved significantly.

After, I changed the ambien parameter to the material (ambient default (0,0,0)) and render the meshes in RM_LIGHT mode.

Code:
NameMaterial.ambient.set(1,1,1);

The next image show the picture above with ambient (1,1,1) and the picture below with default ambient (0,0,0). It does not show much difference. I have also removed the sun and established the sky, to change the color of water, through:

Code:
Sky.set(Vec(0.5,0.5,1),Vec(0.5,0.5,1));

[Image: capturad.png]

The value material color in the Mesh Editor are (1,1,1,1), perhaps there is no much difference between the images for this reason.

I have not changed the material color, because default material color is (1,1,1,1).

Regards.
05-05-2009 11:20 PM
Find all posts by this user Quote this message in a reply
Post Reply