dsman Posted May 17, 2016 Share Posted May 17, 2016 What is the difference between PBR materials and standard material with reflections ? Can't we achieve same result as PBR by having reflection using reflection probe on meshes with standard material ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 17, 2016 Share Posted May 17, 2016 Hello, About the reflection only, for a fully reflective and smooth surface like a mirror, you could achieve the same result with both materials. But, here is the list of what the PBR bring on top of the standard material concening the reflection: A default Fresnel (Schlick fresnel approximation): http://doc.babylonjs.com/overviews/Physically_Based_Rendering#where-are-my-fresnels Gamma Correction: https://doc.babylonjs.com/overviews/Physically_Based_Rendering_Master#gamma-correction Glossiness available through HDR Texture with seamless blur accross faces: https://doc.babylonjs.com/overviews/Physically_Based_Rendering_Master#seamless-cubemap Environment irradiance used to lit the model if used with HDR Texture: https://doc.babylonjs.com/overviews/Physically_Based_Rendering_Master#environment-irradiance So basically, the reflection fits in a lighting model closer from physical light. Your model could also simply be lit by the environment map (e.g. reflection texture) through this system. The following PG does not have any light and you can see a fully white sphere both with standard (black cause the environment does not lit it) and pbr material (impacted by the color of the environment around). http://www.babylonjs-playground.com/#1P98HI#4 If I understand well, you are planning on using the reflection probes which are not integrated with Environment Irradiance or Seamless CubeMap. You then would not see a lot of advantages on using the PBR (on the reflection side only). Please, do not hesitate if you need more information. Quote Link to comment Share on other sites More sharing options...
dsman Posted May 17, 2016 Author Share Posted May 17, 2016 @Sebavan Thanks for reply. So if I understand correctly, everything from reflection to irradiance and zero-light, depends on cubemaps. So can't PBR in babylon do everything (reflection, irradiance) based on live scene that is being rendered? Without use of cube maps ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 17, 2016 Share Posted May 17, 2016 The main issue is time (16 ms). I had to create an extension to preprocess and binary pack cube map cause extracting information and preprocessing it takes around 1 minutes (on only one core) for 256 size on a good machine... About irradiance It is faster but still way too slow to do each frame. I think on some use cases where the scene is mostly locked apart from cam / player, we could probably do something (this would only slow down the loading). I am actually trying to see how to make the whole process easier and faster. Quote Link to comment Share on other sites More sharing options...
dsman Posted May 17, 2016 Author Share Posted May 17, 2016 Well , What if it could be something like reflection probe. Where we can set the frequency of update (update after x frame) ? Or can we render some sort of map from babylon at runtime (at whatever frequency we want) into jpg binary and use that as cubemap for PBR material for reflection/irradiance ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 17, 2016 Share Posted May 17, 2016 yep that is the idea behind it :-) Quote Link to comment Share on other sites More sharing options...
dsman Posted May 17, 2016 Author Share Posted May 17, 2016 So you mean you are in process of creating such extension ? Will it be added to Babylon repo ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 17, 2016 Share Posted May 17, 2016 I am planning to add it as part of performance improvment in the next couple of months. If you need it earlier, I could help you adding it inside of the reflection probes and you could make the PR ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 17, 2016 Share Posted May 17, 2016 Another issue is the rest of your scene will still require a cube map if using pbr to be able to create the cube map... chicken and egg. But could still be really helpfull in a lot of cases. Quote Link to comment Share on other sites More sharing options...
dsman Posted May 18, 2016 Author Share Posted May 18, 2016 @Sebavan Thanks for replying to my stupid question . But pardon me , I am beginner. Will you help me understand different between cubemap and reflection probe ? In your post above you said you can help adding it inside reflection probe. How will that work I mean. The way I understand it reflection probe are for reflection. It has nothing to do with Cubemap and PBR material's reflectivity and irradiance. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 18, 2016 Share Posted May 18, 2016 Hello, Basically a cubemap is like having six images representing each face of a cube. The reflection use them to display whatever pixels are at the reflected position in this cube (skybox like). If a model is enclosed in the cube above (once folded), you could compute the reflected pixel through the following formula (incident angle from normal = reflected angle) : A reflection probe dynamically creates such faces from your running scene. Basically, instead of using a static environment, you could use a dynamic one created from a point in your current running scene. In the following example you can see the moving element being reflected and this could not happen with a static cubemap. http://www.babylonjs.com/Demos/RefProbe/ To compute the environemnt irradiance, you need to loop and compute with expensive maths CPU wise (when you got only 16 ms), a kind of FFT over all the pixels to extract the probability of having one particular color at a particular point ("kind of" averaging the colors of all the neighbours pixels). http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter10.html So if you first render your scene from six angles and then apply the maths to extract the environment irradiance from the generated cubemap, your kind of hammering the performances. It is why doing it at the scene load (if the environment is static) could be ok. Another trick loosing a little bit of accuracy would be to compute the irradiance form lower mips of the generated cubemap to process less pixels. Tradeoff from efficiency to quality would have to be customizable (basically cubemap size, mip generation...). Seamless Cubemap is definitely a no go because it is way too slow to preprocess correctly, webgl2 will help a lot on this (native seamless cubemap filtering can reach closer result without preprocess). Do not hesitate if I am still not clear, jerome 1 Quote Link to comment Share on other sites More sharing options...
dsman Posted May 18, 2016 Author Share Posted May 18, 2016 So basically reflectionprobe can give us 5 surface cubemap that can be used as reflection texture in PBR material ? I noticed every Play ground of PBR is using HDRCubeTexture, like shown below // Environment Texture var hdrTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512); . . . var plastic = new BABYLON.PBRMaterial("plastic", scene); plastic.reflectionTexture = hdrTexture; . . . So instead of this we can use cubemap generated every few second or every few frame from reflection probe ? Can you outline how to achieve this ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 18, 2016 Share Posted May 18, 2016 This generate a cube texture with 6 faces and as stated in the introduction to the PBR Material in the reflection part: https://doc.babylonjs.com/overviews/Physically_Based_Rendering You can use them this way: http://www.babylonjs-playground.com/#1HQPOD#2 dbawel 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted May 18, 2016 Share Posted May 18, 2016 I never read so documented and illustrated answers ... waaaooww 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.