glscene

 

Tips TextureFading

Page history last edited by skinhat 4 yrs ago

The idea here is to simply reduce the diffuse RBG values in the textures material library. Which in turn reduces the materials ability to reflect light. Set the materials texturemode to tmModulate then progressively reduce the diffuse RGB values.

Attach:TexFade.zip

diffuseval := 0.8;

procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);begin

   if diffuseval <= 0.09 then

     begin // blacked out do tex change

       fadeup := true;

       with GLMaterialLibrary1.Materials[0] do

       begin

         if GLMaterialLibrary1.Tag = 0 then

           begin

             Material.Texture.Assign(BM2);

             GLMaterialLibrary1.Tag := 1;

           end

         else

           begin

             Material.Texture.Assign(BM1);

             GLMaterialLibrary1.Tag := 0;

           end;

       end;

     end

   else

     if diffuseval>= 0.8 then

       fadeup := false;

   if Fadeup then

     diffuseval := diffuseval + deltatime * 0.1

   else

     diffuseval := diffuseval - deltatime * 0.1;

   with GLMaterialLibrary1.Materials[0] do

   begin

     Material.FrontProperties.Diffuse.Red := diffuseval;

     Material.FrontProperties.Diffuse.Blue := diffuseval;

     Material.FrontProperties.Diffuse.Green := diffuseval;

   end;

Comments (0)

You don't have permission to comment on this page.