Mark Bufton Posted December 30, 2017 Share Posted December 30, 2017 Hi guys, I'm working on my train windows and want to add reflections. I've added reflection probes to each window and used the attachToMesh(myWindow) method which works fine in that I get reflections, however, the resulting texture won't take into account the scene cameras distance from the window mesh. The result is a huge unrealistic reflection that is out of proportion (particularly with meshes closer to the window mesh). Is there a way to rectify this? Perhaps to move the reflections POV/ghost camera, to match the range and oppose the POV of the scene camera? Perhaps I'm just missing something. Would have set up a playground, but tight on time, will include a screenshot which should highlight what I mean. The code itself is no different to the playground example anyway. The mesh I've used for reflections is the black gangway at the front. Thanks guys! Mark. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 2, 2018 Share Posted January 2, 2018 Hiya Mark! hmm. https://www.babylonjs-playground.com/#AZA2CG#4 I did some playing in lines 49-51... moving the probe z-position... in the opposite direction of camera z position. I'm not really sure what I am doing, but it seems that ... "calculating" probe.position.... using current camera position... is somehow on the right path. Probes have projectionMatrix and viewMatrix as well, and those could be important, too. Matrix-masters could probably have a good time. Mark says, "Perhaps to move the reflections POV/ghost camera, to match the range and oppose the POV of the scene camera?" Yeah, I think that is on-track thinking. The probe._renderTargetTexture is certainly a place to experiment. Show us your test results... if you play with this playground and make some discoveries, ok? thx. I wish I was more experienced on this subject. Hopefully, others will have better comments, soon. NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Mark Bufton Posted January 3, 2018 Author Share Posted January 3, 2018 Thanks :-) I shall have a nice play later and let you know how I get on. Think I'm on the right track, especially with the ghost camera range. The cube texture is correct but the scale is out. Will be great fun to experiment. Hope you had a good Christmas :-) Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Mark Bufton Posted January 9, 2018 Author Share Posted January 9, 2018 I've managed to create a simple fix using mirrors rather than reflections. Seems that so far I can get away with it, considering the window shapes not being too far off a rectangle. I created a window() function to combine 2 plane meshes, change their colour to black and visibility to 0.25. Then add mirror textures to each. Doesn't seem too bad at the moment, but might be a pain later haha. The results are much more convincing, but limited to plane or ground meshes. Shouldn't pose a problem if I can be creative with their design/placement. Still playing with probes though. GameMonetize 1 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.