Jump to content

Render a second Camera to a Texture?


SpiderPig
 Share

Recommended Posts

Yeah, your model did. But I did the exact same thing to mine and it didn't. I tried a cube exported from blender with the same materials and through the same process and yet nothing again....no idea...maybe my programs are in need of updateing or somthing. I have UU3D v3.0 and blender 249.2 and leadwerks 2.4.

Link to comment
Share on other sites

I think this still comes under the same topic:

 

How do I render lights and shadows to the ComputerBuffer?

I tried this code but I get no change at all;

 

               TBuffer currentb=CurrentBuffer();
TWorld currentw=CurrentWorld();

SetWorld(ComputerWorld);
RotateEntity(cube,Vec3(0,EntityRotation(cube).Y+=1,0));
UpdateWorld(AppSpeed());

SetBuffer(ComputerBuffer);
RenderWorld();

SetBuffer(ComputerLightBuffer);
RenderLights(ComputerBuffer);


ComputerTexture=GetColorBuffer(ComputerBuffer);
SetMaterialTexture(mat1,ComputerTexture,0);
SetBuffer(currentb);
SetWorld(currentw);

 

I've created a directional light after the creation of the ComputerWorld and ComputerLightBuffer is exaclty the same as ComputerBuffer. What am I doing wrong?

 

EDIT: Figured it out. I have to get the color from the light buffer instead of the geometry buffer...

 

       TBuffer currentb=CurrentBuffer(); 
       TWorld currentw=CurrentWorld(); 

       SetWorld(ComputerWorld); 
       RotateEntity(cube,Vec3(0,EntityRotation(cube).Y+=1,0)); 
       UpdateWorld(AppSpeed()); 

       SetBuffer(ComputerBuffer); 
       RenderWorld(); 

       SetBuffer(ComputerLightBuffer); 
       RenderLights(ComputerBuffer); 


       ComputerTexture=GetColorBuffer(ComputerLightBuffer); 
       SetMaterialTexture(mat1,ComputerTexture,0); 
       SetBuffer(currentb); 
       SetWorld(currentw);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...