Fwd: Re: RE: [Algorithms] per-pixel specular lighting problem
Brought to you by:
vexxed72
From: Wolfgang E. <wol...@we...> - 2002-06-30 10:05:19
|
Dan, so clamping is only done "through the pixel shader instruction", not "thro= ugh the vertex shader output registers" =3F Thanks, - Wolf >=20 >=20 >=20 > "Dan Baker" <dan...@wi...> schrieb am 30.06.02 01:52:5= 9: > > TEXCOORD is defined to clamp from 0 to 1. TEXCRD (the ps.1.4 version, = they actually share the same Opcode) will give you a result from -8 to 8 (= at least), perhaps beyond. You can multiply by 8 in the vertex shader and = then divided at the end. This is just fixed point stuff, so it is easy to = shift stuff around.=20 > >=20 > > On ps.1.4 you could do something like (if you didn't want to do a depe= ndent read): > >=20 > > TEXCRD r0.xyz, t0.xyz=20 > > TEXLDD r1 , t1 > > Dp3 r0.xyz, r1=5Fbx2, r0 > > //raise a few powers put into r1 > > //be careful to preserve the sign!!! > > //or else dark things get lit too. > > mul=5Fd8 r0.xyz, r1, r0 > >=20 > >=20 > > On ps.1.1 I'd recommend something like > > Tex t0 > > Tex3x2 t1,t0=5Fbx2 > > Tex3x2 t2,t0=5Fbx2 > >=20 > >=20 > > Anyway, I had a few ideas on how to get some more precision - the prob= lem is they burn up nearly all of your instructions. The total cost just s= eamed more then looking up the value in an attenuation map (which is way m= ore flexible). I havn't had time to try them out since I am considerably o= verworked at the moment :) > >=20 > >=20 > >=20 > > -----Original Message----- > > From: Wolfgang Engel [mailto:wol...@we...]=20 > > Sent: Saturday, June 29, 2002 10:35 AM > > To: gda...@li... > > Subject: [Algorithms] per-pixel specular lighting problem > >=20 > > Dan, > > >It turns out that TEXTURE coordinates are often 24 bit. So if you tak= e=20 > > >a do tex3x2 transform it is a 16+ bit value times an 8 bit normal=20 > > >sample. You've lost some precision on the normal quantification, but=20 > > >the result is still reasonably high precision. > > ps.1.4 texture coordinates has a range of [-2048..2048] on RADEON 8x00= hardware when you use texcrd to load the data. If you use texld to load t= he data, you can get a range of [-8..8]. If you put the data into one of t= he oT0 - oT5 vertex shader output registers it will be clamped to [0..1] (= that's what the documentation says). I guess that this is not true. Even i= f it is clamped to [0..8], biasing the values from [-8..8] to this range w= ould lead to a lower precision. Is that correct =3F > > - Wolf > >=20 > >=20 > > -----Urspr=FCngliche Nachricht----- > > Von: gda...@li... [mailto:gdalgorithm= s-l...@li...] Im Auftrag von Dan Baker > > Gesendet: Friday, June 28, 2002 11:59 PM > > An: gda...@li... > > Betreff: RE: [Algorithms] per-pixel specular lighting problem > >=20 > >=20 > > That doesn't surprise me. You are gated by the precision of your input= s > > - both of which are approximately 8 bits on most hardware. That is, if= you do a dot product on two values that are 8 bits precise, you can reall= y expect a result that has more precision then this. With Specular, often = only 5 or 6 bits count, leaving nasty banding. About the ONLY thing I thin= k you can do is add in some noise. > >=20 > > The advantage of using a texture for your computation is very subtle. = It turns out that TEXTURE coordinates are often 24 bit. So if you take a d= o tex3x2 transform it is a 16+ bit value times an 8 bit normal sample. You= 've lost some precision on the normal quantification, but the result is st= ill reasonably high precision. > >=20 > > The only way I've found to get decent specular highlights at a pixel l= evel on < ps.1.4 parts is to use a dependent texture read. You only need o= ne texture stage to attenuate though (on 1.3).=20 > >=20 > > -Dan > >=20 > > -----Original Message----- > > From: Jim Page [mailto:jp...@ho...]=20 > > Sent: Friday, June 28, 2002 7:35 AM > > To: gda...@li... > > Subject: RE: [Algorithms] per-pixel specular lighting problem > >=20 > > I tried it out tom, with different variaties of A and B, and i still g= et > >=20 > > almost that same exact result that was in that screenshot, unfortunatl= y. > >=20 > > narrowed it down to having to use only x^4 even.. I guess whatever is= sues=20 > > that make the banding still apply.. :-| ..thank you, though. > >=20 > > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F > > MSN Photos is the easiest way to share and print your photos:=20 > > http://photos.msn.com/support/worldwide.aspx > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Caffeinated soap. No kidding. > > http://thinkgeek.com/sf =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F > > GDAlgorithms-list mailing list GDA...@li...= > > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > Archives: http://sourceforge.net/mailarchive/forum.php=3Fforum=5Fid=3D6188 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Caffeinated soap. No kidding. > > http://thinkgeek.com/sf =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F > > GDAlgorithms-list mailing list GDA...@li...= > > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > Archives: http://sourceforge.net/mailarchive/forum.php=3Fforum=5Fida88 > >=20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > No, I will not fix your computer. > > http://thinkgeek.com/sf > > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F > > GDAlgorithms-list mailing list > > GDA...@li... > > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > Archives: > > http://sourceforge.net/mailarchive/forum.php=3Fforum=5Fida88 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > No, I will not fix your computer. > > http://thinkgeek.com/sf > > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F > > GDAlgorithms-list mailing list > > GDA...@li... > > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > Archives: > > http://sourceforge.net/mailarchive/forum.php=3Fforum=5Fida88 >=20 >=20 |