jPCT - a 3d engine for Java > Support

Scale X and Y axis

<< < (2/2)

itsmeveno:
Thanks for this.

MichaelJPCT:

--- Quote from: EgonOlsen on February 01, 2019, 08:30:14 am ---Apart from that: We are talking about Android/jPCT-AE here? In that case, you can't do it this way unless some more setup work which might not be worth it. There's another way, though. You can tweak the rotation matrix directly. This has some drawbacks as well, in particular it might increase a light source's brightness on the scaled object when it shouldn't and it doesn't work well together with the build-in scale methods. Anyway, this is how it works:


--- Code: ---Matrix scale=new Matrix();
scale.set(0, 0, 2); // 0,0 for x-axis scaling, 1,1 for y, 2,2 for z
obj.getRotationMatrix().matMul(scale);

--- End code ---

If you otherwise don't change the rotation matrix, you only have to apply this once. If you set it to a new anyway in each frame (or even sometimes), you have to apply this afterwards. Also keep in mind that scaling is cumulative. That means that doing this by 2 and then by 3 will result in a scaling of 6.

--- End quote ---

hi Egon, i read this thread and remember that i used to tried lengthening the normal vector to change lighting effect (over bright effect ? :) ) , i did that when meshes were created from vertex info, such as multiplying the normal by 5. but the lighting didnt change at all, seems like the normal vector is normalized when rendering.
can this behavior of normalizing the normal vector be canceled?
i was just exploring possibilities.

EgonOlsen:
Which version of jPCT (desktop or Android) and which rendering mode are you using?

MichaelJPCT:
i tested it on jpct-ae only,  openglES 2.0

EgonOlsen:
I think the default shaders are normalizing them again.

Navigation

[0] Message Index

[*] Previous page

Go to full version