Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rendering to a Texture

Started by Gary Aug 9, 2001 at 7:35 PM 5 replies 350+ views
Original Post
Gary
Gary
I have a program which renders a model to a texture and then places it as an overlay..... It works completely fine when I have: PR_SetD3DPipeline (0) However, when I have PR_SetD3DPipeline (1) only materials that are non-gouraud are rendered. So, just plain texture works fine but if I use Gouraud or GouraudTextured it doesn''t get rendered. I know it''s not a lighting issue because I have all of the ambient light values set to 255 and it works when run through the PR Pipeline. The model also renders fine if it isn''t rendered to a texture..... Gary
ChrisE
ChrisE
Are you transforming the lights again after you switch rendering targets?
Author of Power Render (http:/www.powerrender.com)
Gary
Gary
No, because I''m not actually using any lights...... I''m using the gouraud rendering method because I need to be able to change the color values, the lighting part isn''t important for what I''m doing.

I had thought that with the ambient light value set to max that it would be fine. Do I need to transform a light, even if I''m not using one?


Gary
Gary
Gary
Ok, I just tried putting in a light and trying again.

I got more of a result. Where the light was set, that part of the model was lit by the light. The thing is I want it fully bright which is why I set the ambient light values.


Why arn''t the Ambient Light values doing anything?


I noticed this same problem with the Simple Land program as well. When I changed the terrain engine to have light, ambient light values did absolutely nothing....


Gary
ChrisE
ChrisE
Ambient colors are currently not hooked up with the D3D pipeline.

Here is a function you can use to set the ambient color for the D3D pipeline instead:

void PR_SetD3DAmbientLight (PR_REAL r, PR_REAL g, PR_REAL b)
{
D3DCOLOR dwColor;

dwColor = D3DCOLOR_RGBA(r,g,b,255);
PR_Globals.PR_Direct3DDevice->lpVtbl->SetRenderState(PR_Globals.PR_Direct3DDevice, D3DRS_AMBIENT, dwColor);
}

There is a PR_SetAmbientLight function but it only sets the variables used in the PR pipeline. I''ll make it call this code as well in the future.
Author of Power Render (http:/www.powerrender.com)
PsycoBlade
PsycoBlade
Gary, how do you render directly to a texture? I always thought you had to render to the screen, and then copy the screen to a texture. Thanks.

-Rich
Gary
Gary
PsycoBlade, older video cards, like the Voodoo II can't render directly to a texture. However, newer video cards can.

Somewhere in one of chris's examples he does it and this is where I learned how to do it.

It's not difficult at all so I just shoved my code into the SimpleObject example. I'll upload it to the FTP when I can connect to it (The FTP seems to be down right now).



BTW: Chris, the function works great but the rbg variables you posted need to be int, not float.


Gary


Edited by - Gary on August 10, 2001 9:52:48 PM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.