# [HLSL] Simple scaling using Normals

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

## Recommended Posts

Hello, I have a mental block! Help! I am trying to perform a simple scaling operation of my mesh in HLSL. I thought it would be as simple as this:

float scale = 4.0;

VS_OUTPUT VS(	float4 Position 	: POSITION,
float4 Normal   	: NORMAL)
{
VS_OUTPUT OUT	= (VS_OUTPUT)0;
OUT.Position	= mul( Position + (Normal * scale), WVP );
return OUT;
}


I know my normal data is fine as I am using the same mesh in a different lighting effect. Any suggestions? Thanks

##### Share on other sites

Suppose position is 100.0,400.0,-1000.0. By scaling the normal you add/subract a small value, so the object will look the same.

If your object is centered at 0,0,0 there's no reason to use the normal to scale it.. a simple Position*Scale should be enough.

##### Share on other sites
Hmm.

I thought I was modifying the position of each vertex in ObjectSpace, before transforming each vertex, so this is irrelevant to the world position of the object.

I agree, the scale multiplier needs to be in proportion with the size of the object to notice any difference.

As long as the object is convex, this should make it bigger, no?

##### Share on other sites
Quote:
 Original post by sipicklesHmm.I thought I was modifying the position of each vertex in ObjectSpace, before transforming each vertex, so this is irrelevant to the world position of the object.

You're right, object space works this way. I was just pointing out a general rule. :)

Quote:
 As long as the object is convex, this should make it bigger, no?

Yes.

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 10
• 23
• 9
• 48
• ### Forum Statistics

• Total Topics
632637
• Total Posts
3007577
• ### Who's Online (See full list)

There are no registered users currently online

×