-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
THREE.TextureProjector / THREE.ProjectionMaterial? Project texture onto geometry from a camera #5114
Comments
I think @arodic has experience with this already :) |
I see that this post has been considered to be an enhancement request to add projective texturing to three.js. For reference, there is an example of projective texturing in this stackoverflow post, including a live demo. |
Thanks a lot, that's perfect, much better way of doing it. I just hacked on it for a bit and now have it projecting a video texture onto a bunch of cubes! I'll clean it up and post it in a fiddle or something. Second question: how would I go about making a spotlight that projects a square? What's the easiest approach? I did some googling and looked through a bit of the source, but it's not immediately apparent to me where the circular part of the spotlight is coming in. |
I would say it's in the shader. Have a look at PR #5080. |
Thanks, noted! I'll take a look. Feel free to close this out if it doesn't seem like a good enhancement at the moment, I'll chime back in if I get it to a good spot :) |
Great! |
@flimshaw Adding projective texturing to three.js would be an excellent enhancement !
You would add a mask to the spotlight. An |
I have a specific need. I would like to use a mesh with an existing map, project an image on it and update the original texture with the projected image (keeping the original UVs of course). Is there a way to do this? |
@yokotsumo Your best bet for getting help is on stakoverflow, where you have previously posted your question. As stated in the guidelines, help requests should be directed to stackoverflow. This board is for bugs and feature requests. |
This could be a nice feature of Three.js |
Hey there,
I started messing with this feature last night, I wanted to see if there was already something along these lines before I go further, or see if this was the best way to go about it. Here is a real rough demo: http://charliehoey.com/threejs-demos/projector-demo.html
I want to have an image/video that is projected onto a mesh dynamically. To do it, I'm using a Projector to convert vertex coordinates to screen coordinates (ie: what part of the texture is hitting that vertex), then converting that to UV coordinates for the texture, and then applying those UV coordinates to the geometry each frame. It seems to kind of work, except that the angles seem off on one of the floor triangles, not sure what's going on there yet.
Any thoughts? Think this is the right way to go about this sort of thing? If I could get shadows/directional occlusion working someday too, that'd be pretty cool. Someday maybe :)
The text was updated successfully, but these errors were encountered: