Scaling world matrix kills light

Scaling world matrix kills light

Post by SVR » Mon, 25 Mar 2002 05:51:07



When you scale the world matrix Directional lighting
gets darker !!! Whats up ? Directional lights are SUPPOSED
to be infinite and non-positional. How is one supposed to
put objects of various size in a scene ???

Light works fine if you scale the vertices manually but
the whole point of a world transform is to transform
objects into world space ! Besides , if you scale /
translate model vertices too much they get messed up
down the render pipeline causing Zbuffer probs.

Does Microsoft know about the problem ? I tried to find a
way to email them but ran into their Support Prevention
Service website. Gotta luv it.

SVR
--
"Please remove NO SPAM to email me"

 
 
 

Scaling world matrix kills light

Post by Cronus3 » Mon, 25 Mar 2002 06:09:52


are you renormalizing normals?

 
 
 

Scaling world matrix kills light

Post by SVR » Mon, 25 Mar 2002 06:20:10


Quote:>-----Original Message-----
>are you renormalizing normals?

Nope, Bingo ;-)

I missed the D3DRS_NORMALIZENORMALS defaults to FALSE .
That did the trick, thanks.

--
"Please remove NO SPAM to email me"

 
 
 

Scaling world matrix kills light

Post by Michael Lache » Tue, 26 Mar 2002 19:30:09



> are you renormalizing normals?

Is this necesarry (it would explain a bug i had recently) ? I always
thought the pipeling only scales the vertex coordinates and just rotates
the normals ...

Mucki

 
 
 

Scaling world matrix kills light

Post by SVR » Wed, 27 Mar 2002 00:01:51


YES :0

I thought the same thing. It should'nt scale normals but it just blindly
applies
the transform you give it.



> > are you renormalizing normals?

> Is this necesarry (it would explain a bug i had recently) ? I always
> thought the pipeling only scales the vertex coordinates and just rotates
> the normals ...

> Mucki

 
 
 

Scaling world matrix kills light

Post by Michael Lache » Wed, 27 Mar 2002 01:27:04


Ok ... this explains a lot. So how are you supposed to realize different
sized objects of the same type (in my case: a few hundred trees on a
landscape). I don't really want to allocate memory for each one and
using D3DRS_NORMALIZENORMALS seems slow (a sqrt for each normal, even if
it is in hardware). Making them all the same size is not really
appropriate ... so:

Isn't there a better solution (put aside vertex shaders for now) ??

DirectX Gurus, anyone ?

Mucki


> YES :0

> I thought the same thing. It should'nt scale normals but it just blindly
> applies
> the transform you give it.




>>>are you renormalizing normals?

>>Is this necesarry (it would explain a bug i had recently) ? I always
>>thought the pipeling only scales the vertex coordinates and just rotates
>>the normals ...

>>Mucki

 
 
 

Scaling world matrix kills light

Post by Rich [Microsoft Direct3D MV » Wed, 27 Mar 2002 06:23:18


[Please do not mail me a copy of your followup]



Quote:>Isn't there a better solution (put aside vertex shaders for now) ??

Even if you used a vertex shader, its going to be doing the
equivalent of RS Normalize Normals.

You either guarantee that your normals are normalized by vertex
processing by not using any scaling transformations and setting the
vertex data to unit vectors, or you set RS Normalize Normals to
TRUE.
--
Ask me about my upcoming book on Direct3D from Addison-Wesley!
  Direct3D Book http://www.xmission.com/~legalize/book/
    izfree: Open source tools for Windows Installer
            http://izfree.sourceforge.net

 
 
 

Scaling world matrix kills light

Post by SVR » Wed, 27 Mar 2002 10:13:59



<<snip>>

Quote:> Isn't there a better solution (put aside vertex shaders for now) ??

> DirectX Gurus, anyone ?

> Mucki

I used prescaled normals (saved a set of normals for each scale version of
an object)
in the past. Saves alot of render time processing at the cost of memory/load
time. Its
was tricky to figure out the right scale to end up with the right result. I
forget the details.
I think I used just an inverse of the scale matrix with no rotation in it.

Sloan

 
 
 

Scaling world matrix kills light

Post by Michael Lache » Wed, 27 Mar 2002 17:30:08



> [Please do not mail me a copy of your followup]



>>Isn't there a better solution (put aside vertex shaders for now) ??

> Even if you used a vertex shader, its going to be doing the
> equivalent of RS Normalize Normals.

Oh, i wouldn't use 4x4 matrices in my vertex shader. I am using SRT
transformations now which I convert to matrizes in the end, so I would
write a shader which uses them directly. the rotation is stored as 3x3
matrix so there should be little speed loss and I can just skip the
scaling and rotation part for normals.

But as this is also quite a lot of work: How much performance impact
does the normalize renderstate have ? Is it done in hardware on T&L
cards (it has to i guess), and: is it expensive ?

Mucki

 
 
 

Scaling world matrix kills light

Post by Michael Lache » Wed, 27 Mar 2002 17:31:44





> <<snip>>

>>Isn't there a better solution (put aside vertex shaders for now) ??

>>DirectX Gurus, anyone ?

>>Mucki

> I used prescaled normals (saved a set of normals for each scale version of
> an object)
> in the past. Saves alot of render time processing at the cost of memory/load
> time. Its
> was tricky to figure out the right scale to end up with the right result. I
> forget the details.
> I think I used just an inverse of the scale matrix with no rotation in it.

> Sloan

sounds ok for objects with discreet sizes .. but I think in my engine
this is not appropriate. I have a scenegraph architecture and the actual
scale of an object also depends on parents and so on...

Mucki

 
 
 

Scaling world matrix kills light

Post by Rich [Microsoft Direct3D MV » Thu, 28 Mar 2002 00:21:48


[Please do not mail me a copy of your followup]



Quote:>Oh, i wouldn't use 4x4 matrices in my vertex shader.

Doesn't matter -how- you do the transformation, if it does anything
other than translation you're going to have to perform the
transformation on the normals as well.  If the transformation
contains a scale, you're going to have to renormalize the normals as
well.
--
Ask me about my upcoming book on Direct3D from Addison-Wesley!
  Direct3D Book http://www.xmission.com/~legalize/book/
    izfree: Open source tools for Windows Installer
            http://izfree.sourceforge.net
 
 
 

Scaling world matrix kills light

Post by Michael Lache » Thu, 28 Mar 2002 00:29:57



> [Please do not mail me a copy of your followup]



>>Oh, i wouldn't use 4x4 matrices in my vertex shader.

> Doesn't matter -how- you do the transformation, if it does anything
> other than translation you're going to have to perform the
> transformation on the normals as well.  If the transformation
> contains a scale, you're going to have to renormalize the normals as
> well.

yes ... but SRT transformation stores scale rotation and translation
seperately (ie: a float for scale, a 3x3 matrix for rotation and a 3x1
vector for translation). So i can just skip the application of scale for
the normals and everything will be fine.

Mucki

 
 
 

1. Kill, kill, kill the bones.....

Hi!

I could just explode of anger !
Okay, okay, okay (Leo Getz voice ;) )

I have modelled this strange. two-legged amphibian creature, and
I am quite satisfied with it.
Of course, the fool I am wanted to BONE it.
Oh MY GOD, what a MISTAKE.

I rotated the legs a bit so that the muscles come out
better, the tips of the feet are facing SLIGHTLY inward.

Okay, okay, okay.
I put in the bones, add the two first goals for the feet...
and what happens ?
I move to frame one to make a test-motion, and as soon as
I move "Foot_Left_Goal", the footbone turns around, faces
the goal-object (!) and the whole thing looks like a DUCK
WALKING :(((

Now, I have read all the stuff in manuals 100 times.
I`ve read about the gimbal lock, I`ve read about the
helicopter rotor blades in the manual, and I have read the tip
that it would be better to model those blades in a special way
and rotate them in layout.

So far, so good.
But why the heck do the bones adapt the orientation of the feet,
when they should (as described in the manual)be a tool to deform
the object, not vice versa ???

Really NewTek, maybe I am not the brightest star in the skies, but I am
givin` a try to them bones every other week, and since several months, and still
don`t get 100% what I want.
The bones are sooooo complicated and so un-intuitive.
There`s so many work arounds You have to use to get what You need.

I really don`t like it :(

CU L8ER,

Emmanuel, Team *AMIGA* , Surfin` the LIGHTWAVE!
Producer of PHOENIX
__

Visit the PHOENIX Site under: http://www.xgw.fi/~slice/ftales/
Die deutsche Homepage:        http://www.germany.net/teilnehmer/101,19879
Our publisher`s site :        http://www.chiemgau.com/apc&tcp

"If You had seen with Your eyes what I have seen with Your eyes..."

2. question on pickedpoints

3. View matrix/ World matrix problem

4. Question On 'Rendering' Lines

5. light kills color (simple help)

6. Oooh, and I thought they could only do that at Pixar....

7. Will 3dsPRO kill Lightwave? NEWTEKS KILL

8. Keep Me Honest, I'm writing my own SUCCESS story...

9. Wanted: Algorithm to extract scale/rotation factors from matrix

10. Dumb 3D question about my Scale Matrix

11. Scaling an inertia matrix ?

12. How to get the sign of the scale in a 3D transform matrix

13. Extracting scale from a 2D matrix