Jump to content

Error when using PBRMaterial


onetrickwolf
 Share

Recommended Posts

var material = new BABYLON.PBRMaterial("ball player", scene);
material.diffuseTexture = new BABYLON.Texture("assets/02_Ball Player/ball_player_D.png", scene);
material.bumpTexture = new BABYLON.Texture("assets/02_Ball Player/ball_player_N.png", scene);
material.specularTexture = new BABYLON.Texture("assets/02_Ball Player/ball_player_S.png", scene);

//Attach the material to the sphere
mesh.material = material;

The above works fine when swapping out PBRMaterial with StandardMaterial.  When I do PBRMaterial though I'm getting: Uncaught TypeError: Cannot read property 'PrepareDefinesForLights' of undefined

Any ideas?  Thank you sorry still trying to figure this out.

Link to comment
Share on other sites

what happens when you try this

var pbr = new BABYLON.PBRMaterial("pbr", scene);
pbr.cameraExposure = 0.66;
pbr.cameraContrast = 1.66;


and assign that to the mesh
or

    //Creation of a material
    var materialSphere = new BABYLON.PBRMaterial("Material_" + j, scene);
    materialSphere.albedoColor = new BABYLON.Color3(0.2, 0.9, 1.0);
    materialSphere.reflectivityColor = new BABYLON.Color3(reflectivity, reflectivity, reflectivity);
    materialSphere.microSurface = microSurface;
materialSphere.reflectivityTexture = texture;
materialSphere.useMicroSurfaceFromReflectivityMap = true


they are direct copy and pastes from http://doc.babylonjs.com/overviews/Physically_Based_Rendering
 

also what kind of light do you have in the scene?  Im pretty sure a PBR would be dependent on the lighting seeing how its trying to simulate a realistic model...  perhaps try changing your lights?  Im not sure I have not yet got to PBR implementation on any of my projects yet so this is kinda just a shot out in the dark.  But from what I see its properties are not the same as the standard material.

Link to comment
Share on other sites

Updated to preview release worked thanks didn't know this was a preview feature!  However, the only texture that works is the bumpTexture (it looks amazing though!).  The diffuse and specular don't seem to be working.  Any idea why?

Thanks for always be so helpful Deltakosh will try to repay the forum in the future by answering questions once I know more!

 

 

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