Sign in to follow this  

Sample RenderTarget texture problem

Recommended Posts

Sorry for my English. I do some things as follows: 1. Create two render-target texture S(scene) and B(bump). 2. Render scene to S texture. 3. Render some objects(object's texture only has red and green) to B texture. 4. Use B to offset S's texcoord for producing distort effect. (I used ps 2.0) In shader,sample B is ok,But use B(texcoord) to sample S don't correct for some pixel. I change S to normal texture (I read data from image file.) do step 3~4 ,result is ok. Who can tell me,how to solve the problem. //DirectX 9.0c //Geforce 5200 Thanks.

Share this post

Link to post
Share on other sites

did you try debugging your shader in Visual Studio and see the exact values you read? Maybe that could help you find the soultion. Also, if you post some relevant parts of your source code, we could help you better!
Hope you will find your bug..


Share this post

Link to post
Share on other sites
Thx your reply!!

My Vs and PS codes as follws:
dcl_position0 v0;
dcl_position1 v1;
mov oPos,v0;
mov oT0.xy,v1;
//c0 [scale_x,scale_y,0,0] => scale bump offset
dcl_2d s0; //Scene Texture(ocean box)
dcl_2d s1; //Bump Texture(four spheres)
dcl t0;
dcl t1;
texld r0,t0,s1;
mad r0.xy,r0,c0,t0;
texld r0,r0,s0;
mov oC0,r0;

if "S"(ocean box) and "B"(four spheres) are RenderTarget,result is as follows:

Then I changed "S" to normal texture(read data from image file),result is as follows:

I don't use two rendertarget texture at the same time?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this