Jump to content
  • Advertisement
Sign in to follow this  
yurixd

Texture coordinates in pixel shader

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I have been reading the book of Shader X . There is an example in image processing, where they did a Cross Gradient Filter and another where they did sobel filter (pag 263 and 264). ps.1.4 def c0, 0.3f 0.59f, 0.11f, 1.0f texld r0 t0 texld r1 t1 //down right texld r2 t2 //down left ...... Can someone told me, how they get to put the good coordenates in t1 and t2 ??? Which is the format of t2 registers, quad-floats?? Is it possible only to get the values of the coordonates ? I think, pixel shader is iterated...every time for each pixel given by the rasterizer, but i-m not sure. Can someone told me if I am wrong?? I-m trying to have a object 2D and rotate it. Since I rotated, the coordonates will be fractions. So I would like to do an interpolation of the 4 texture values around my new coordonates. Any help will be really useful. Thanks, Jesus

Share this post


Link to post
Share on other sites
Advertisement
1. In the vertex shader they probably wrote the texture coordinates into the output registers
2. I think all constants and registers are float4. The texture coordinates are interpolated at full precision but apparently colors are only interpolated at 8-bit precision (NVidia were saying that their new card would interpolate colour at full precision)
3. You can only read those input registers and (I think) only write the output registers - you need to use the temp registers to read and write.
4 I'm not sure what iterated means in that context but it is executed for each pixel, or for each fragment if you're using multisampling.

Could you paste/type out the vertex and pixel shaders so we can help with...whatever you said :p

Don't you find it a bit annoying when older books use assembler rather than HLSL?

Wow your name is Jesus! That's amazing!

Share this post


Link to post
Share on other sites
HI! Thanks for your replay!
DO you think is possible to do the same things in HLSL than in assembler? I don't know really. In HLSL seems that you don't know really what are you exactly doing, and write pixel and vertex shaders are short. But maybe I am wrong. If you think I can do exactly the same, (image processing), could you give me any advice about tutorial or book in HLSL ??
Thanks,
JEsus

Share this post


Link to post
Share on other sites
Hi

HLSL's done everything I need to do - you can certainly do most of the same as assembler with it.

I'm afraid I don't know of any tutorials, though I'm sure there are some free on the internet if you Google.
I learnt HLSL by reading one of the first chapters of 'Real-Time 3D Terrain Renderering with C++ and DirectX 9' [Greg Snook] and reading the DirectX docs which are actually quite good. It took a while for me to build up confidence with them - fiddling with the sample effects that come with EffectEdit did the trick.

I do image processing with effect files [grin]. Coding my image processing framework took ages though :(

Cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!