Jump to content

Realtime PBR: Glass, metal & wood


GameMonetize
 Share

Recommended Posts

Woohoo!  Breathtaking. You don't know how long I've tried to get materials to look that good! That glass refraction is exactly what I needed :)

Is there a tool or workflow to convert PBR materials from other systems like Unity/UE4/Allegorithmic into Babylon materials?

Link to comment
Share on other sites

Hey, thanks for the lead, A.  I was typing a PM... when I was notified that you just now mentioned me in a post.  So, here I am, and HI! 

Holy crap, those materials are looking nice.  PBR.  Drink it in!

photo-realistic?  Yeah, I think that is the general term.  (droooool)

It would be fun to darken that scene, turn-on a single candle with the new pointLight shadows feature... and then see the reflections flash in the gloss... as the pointLight candle flickers.  Plus, the shadows will flicker with the candle, too.  sigh.  I love candles/torches.

Thanks DK and contributors!

Link to comment
Share on other sites

Hi @Wingnut It's Physically Based Rendering :) and yeah I'm drooling at the materials too! lol.

@Deltakosh I'm trying to use PBR materials in my current project, I downloaded the latest code yesterday, but it says

"BABYLON.PBRMaterial is not a function" when I use the preview release.

"BABYLON.HDRCubeTexture is not a function" when I use 2.3 release.

I'm trying it locally, so attached the source zip for reference.

I copy pasted the code from the demo playground scene and didn't change anything except the textures path (I named the folder as "images" instead of "textures").

http://www.babylonjs-playground.com/?28

hdridemo.zip

Link to comment
Share on other sites

You have to use the PBR material by including this file : https://github.com/BabylonJS/Babylon.js/blob/master/materialsLibrary/dist/babylon.pbrMaterial.min.js

Regarding the HDRCubeTexture, you have to use the 2.4 preview version: https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview%20release

Link to comment
Share on other sites

Hi guys.  Here's a super-complete zip of the package (but with non-min version of pbrMaterial).  All JS is included.

http://urbanproductions.com/wingy/babylon/hdr_pbr/bjs_hdr_pbr.zip

index02.htm is standard scene. 

index03.htm is another version that I included in the zip.  It is glass and wood only, no plastic or metal. 

One way I learn about the tweek-able "knobs" of a new system (its properties)... is to animate them with a sine value-range sweep.  Index03 is my early steps at that.  I animated glass.indexOfRefraction and then I tried to put some dynamicTexture readouts on a pair of planes.  As almost always, the dynamicTexture is wide and squatty.  (Verdana is not the best font to use for dynamicText). 

I side-tracked to fix the text readouts, and haven't returned to playing with the pbr and hdr yet.  But, an indexOfRefraction range sweeper is active in index03.  Grab this zip... because the playground zip flops-dead when trying to zip that big room.hdr  (part of the fun)  :) 

As for looking around the web for other .hdr files, the correct format of .hdr needed for this system... is pretty rare.  If someone has links or knowledge about different .hdr formats, please point or talk, thanks. 

(That is... IF we are in an appropriate thread for pointing or talking.  I'm all paranoid about where I post, these days.  We don't have a "talk about anything you damned well feel like talking about" forum category.  Sigh.  Friggin' programmers and their tendency to "box" everything.  Yech!   They sure cramp the style of we rubbery liquidy analog type.)  :o:)

PS:  In an early test, I tried putting the glass sphere atop the wooden plank, bringing the camera close, and using it as a magnifying glass... to examine the wood plank.  Quick-tests were having problems getting the glass to go transparent.  I could not see the wood through the glass.  Again, though, I didn't spend much time experimenting, yet.  Besides, it's a REFLECTION, Mr.Wingy.  Using the glass sphere as a fish-eye lens for the camera... well... that will probably not work.  :)

Link to comment
Share on other sites

Wingy, if you want to see the wood plank in the sphere, you will have to add it to the refraction texture.

For this, you can use reflection probes, add the wood plank in the renderList, and generate a cubemap from it. You can then add the cubemap as refractionTexture in your sphere and you're done :)

Link to comment
Share on other sites

hahaha.  Oh is THAT all I need?  Well hell, I should have deduced that with the first cup of morning coffee.  :)

Thanks, though, Temechon.  You essentially taught me how it all works, in that short little post.  Good job!

I'm headed under my bed, now, joining the dog.  :D

Link to comment
Share on other sites

  • 1 year later...
On 10/2/2016 at 0:17 PM, Dal said:

Woohoo!  Breathtaking. You don't know how long I've tried to get materials to look that good! That glass refraction is exactly what I needed :)

Is there a tool or workflow to convert PBR materials from other systems like Unity/UE4/Allegorithmic into Babylon materials?

I know that this is and old post, but I would like to know the answer for the question Dal made. Specifically, I'm interested to know if there is some way to convert Allegorithmic materials to PBR materials.

Thanks in advance.

Link to comment
Share on other sites

  • 1 month later...

Hello again.

As @Delkatosh suggested, I'm trying to use Unity to export a very simple scene from Unity to Babylon. I've imported to the Unity project an Allegorithmic material, which has a .sbar extension.

When the scene is exported, this sbar file is used as the name of the texture to use, for instance:

"name" : "wood_elm_japanese.sbsar",

 

But I think those file format encapsulated some different textures inside them , as you can see on the attached image.

So the question is. I'm doing something wrong ? or maybe is that those assets are not supported on Babylon exporter.

Thanks in advance.

Best regards

 

asset.babylon

Capture.png

Link to comment
Share on other sites

  • 2 months later...

Hello! 

How can I add refraction of surrounding objects to glass material in example http://www.babylonjs-playground.com/?28, without loss of refraction of HDR map?

I mean, if we use BABYLON.RefractionTexture to push objects to renderList, then we cannot add HDRI environment to glass.refractionTexture, because we can't add two different textures (HDRI and surrounding objects) to material at the same time. Glass doesn't look realistic if we cannot look at other objects in the scene through it.

 

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...