Russell Posted December 11, 2023 Share Posted December 11, 2023 Hi there team, time no see... I'm still working on the v4.0 Update for my Steam game. And one of the addons inside this update, was the option of drive an Opel Kadett car... And here is my question about... I have develop the mirror effect with a Camera using RenderTarget option on a Texture, and then the script: Script.TexturaProyecta=""--string "Textura" function Script:Start() local tex=Texture:Load("Materials/MisTexturas/Camaras_Texturas/"..self.TexturaProyecta..".tex") self.entity:SetRenderTarget(tex) end This works fine, but i've got a problem with the final image... Is there a way for make MIRRORED the image on the mirror? I've tried mirroring the texture, or using 2 cameras, but nothing works for me. I've got the same problem on another map: Many thanks in advance for your help. Quote Link to comment Share on other sites More sharing options...
Solution SpiderPig Posted December 11, 2023 Solution Share Posted December 11, 2023 I'd reverse the U coord of the entities texture coords somehow. You might need a shader for that for a render target though. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted December 11, 2023 Share Posted December 11, 2023 Cool idea. Can't you just reverse the U coord in the model? 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Canardia Posted December 11, 2023 Share Posted December 11, 2023 Mirrors are a mystery, can't simply put a camera on it, since the observer moves. 1 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
SpiderPig Posted December 11, 2023 Share Posted December 11, 2023 You'll need to move the camera that renders the mirror based on the observing cameras position I think. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 11, 2023 Share Posted December 11, 2023 I would try something like this but in 3D. 1 Quote Link to comment Share on other sites More sharing options...
Russell Posted December 11, 2023 Author Share Posted December 11, 2023 Many thanks for your answers... 3 hours ago, SpiderPig said: I'd reverse the U coord of the entities texture coords somehow. You might need a shader for that for a render target though. 3 hours ago, Josh said: Cool idea. Can't you just reverse the U coord in the model? Great idea, but i don't know how make this... I think it would be enough to enter some command in my "tex" variable or within the "self.entity" where I put the SetRenderTarget. But I don't know what code fragment implement to invert the texture in its U coord. 1 hour ago, Canardia said: Mirrors are a mystery, can't simply put a camera on it, since the observer moves. 1 hour ago, SpiderPig said: You'll need to move the camera that renders the mirror based on the observing cameras position I think. In my both cases, I don't need to control the player's perspective movement to make the mirror camera realistic. - In the case of the car mirror, the camera is attached to the body of the car itself. If the car moves, the camera with it. And important, the player camera would not move from the driver's area view. - In the case of the large bathroom mirrors, taking into account their position and the view triangulation, I wouldn't need to control the perspective either. I just need to be able to invert the reflection by reversing the U coordinate of the texture in my SetRenderTarget. But I am not able to implement it. I'm sure I can develop this idea in my script using "tex" o "self.entity": Script.TexturaProyecta=""--string "Textura" function Script:Start() local tex=Texture:Load("Materials/MisTexturas/Camaras_Texturas/"..self.TexturaProyecta..".tex") self.entity:SetRenderTarget(tex) end But no idea how to do it. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 11, 2023 Share Posted December 11, 2023 Find the surface / mesh that uses the reflection material, and then for each vertex do this: Vec2 coord = GetVertexTexCoord(v); coord.x = 1.0f - coord.x; SetVertexTexcoord(v, coord.x, coord.y); 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Russell Posted December 11, 2023 Author Share Posted December 11, 2023 Many thanks Josh, i'm trying your code... At this moment i'm trying to change the TEXTURE MAPPING of the Render Texture and it looks promising for me: If with this I can temporarily solve my case, then it would be matter of implementing the code to improve the effect. Love your patiente guys!! 1 Quote Link to comment Share on other sites More sharing options...
Russell Posted December 12, 2023 Author Share Posted December 12, 2023 Finally with the idea of @SpiderPig of invert coords of the texture i've solved/upgrade my mirror effect... In a future... (Distant future probably... Because coding is hard for me) i will try to improve the mirror effect with this idea: 4 hours ago, SpiderPig said: I would try something like this but in 3D. But at this moment this is enough for me... Many thanks to all of you... By the way... For one of the 4 unlockable hidden maps of the game, I am developing a maze with the different thanks and grateful message (to the people on this forum) that I am going to put along the way. With your nicknames and avatars. Something I mentioned in the next Thread: https://www.ultraengine.com/community/topic/61219-question-about-an-acknowledgments-map-i-want-develop/ This is the map Icon: Unlockable after our Wish to Rhexon Dragon: Again, many thanks team!!! 4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.