Jump to content

Reflection Probes


Mark Bufton
 Share

Recommended Posts

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.

Screenshot_2017-12-30-12-16-44.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...