x


SHADER: Get *object* position or distinct value per *object*

Is it possible to get the current Object's 'base' world position in a vertex function?

I was thinking something like this:

float3 baseWorldPos = mul ( _Object2World, float4(0,0,0,0) ).xyz;

...but on testing I'm fairly certain it's returning a zero vector ( because its a multiplication? ).

Otherwise is there another way to get a distinct value per object, so that a shader's effects can be made unique for each individual object?

Thanks.

more ▼

asked Nov 20 '11 at 07:54 AM

Rook3D gravatar image

Rook3D
16 3 3 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

To get the position, you need to transform float4(0,0,0,1).

more ▼

answered Mar 26 '12 at 02:57 PM

mig gravatar image

mig
15

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2166
x1738
x504

asked: Nov 20 '11 at 07:54 AM

Seen: 995 times

Last Updated: Mar 26 '12 at 02:57 PM