As the title says, I would like to do texture mapping on 3D objects by projecting two-dimensional images.Also, I want to make sure that the position of the projected light source is always the same.
In other words, if you move your perspective, you want to move the light source position accordingly. (It's always like your eyes are a projector.)
http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20150607
Using this source code as a reference, I was able to project the image right away.
I was able to move my point of view.
However, I don't know how to change the position of the light source according to the point of view.
Could someone please tell me?
I'd like a hint, even if it's general.
If you multiply the transformation matrix that rotates the object by the transformation matrix in the shadow map, you will expect it to work.
Specifically,
// Translation matrix for shadow mapping
const GgMatrix ms(ggPerspective(window.getZoom()*0.01f+0.3f, aspect, 3.2f, 6.8f)*mv);
// Translation matrix for shadow mapping
const GgMatrix ms(ggPerspective(window.getZoom()*0.01f+0.3f, aspect, 3.2f, 6.8f)*mv*window.getLtb());
Change as shown in
However, if you are constantly projecting from the viewpoint side like this, you may not need to use shadow mapping (view mapping).
It's been a while since your question, so please forgive me if I lost it late.
© 2024 OneMinuteCode. All rights reserved.