Blender PBR materials

The light probe generates the ambient for PBR. It’s possible to use a generic light probe for your scene… that’s what I do in the Space Bugs game.

I don’t know how to make one. @nehon gave me the ones that I use. :slight_smile:

I still use one I got from his examples as well https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-testdata/src/main/resources/Scenes/defaultProbe.j3o

I’ve been struggling to find a way to generate a nice light probe based on my scene, but none of them turn out nearly as well as the “defaultProbe.j3o” that I have been using in the meantime.

1 Like

ok thanks :slight_smile: , i got it, use light probe, but how can i make this light probe “lit” just more. i already have 1,1,1,1, and directional light not much like 0.5,0.5,0.5,1 and still much more difference between DL and probe light. lowering directional light to 0.2,0.2,0.2,1 is ok, but overall model is too dark then. i would like to do little difference. Any idea?

model have 0 metalness and like 0.8 roughness.

for ambient i see in tutorials was something like “mylight.setColor(ColorRGBA.White.mult(1.3f));” that give over 1,1,1,1 value, but for probe light any value above 1,1,1,1 dont affect it.

i thought about adding pointLight to camera that work anyway, but it sounds like stupid idea.

If you added a new Light Probe with the scene composer by right clicking and pressing “add light”, then it won’t emit any light. Light probes only work once the EnvironmentMap has been generated.

So anytime I want to preview my PBR models in the SDK accurately, I use the pre-generated light probe that I downloaded from the github link I pasted above.

ok, but in game it dont lit much too. i see difference ,but too low one.

in game i got light probe generated from environment camera, in test scene i got only skybox, but i belive EnvCamera should see it… i will try and see with some metalness element to debug.

edit: ok i see in game, simply skybox texture is not “visible” by envCamera?

This is the problem I run into when I try to generate the Environment Maps for the light probe based on my scenes in game. It seems like they are always too dark, especially in comparison to the pre-rendered Light Probe I got from the example in the master branch.

thanks, i understand what is problem.

But i dont understand currently why EnvironmentCamera dont see simple SkyBox to use it in light probe

I had this problem with the Sky Dome I use. The sky was positioned around my camera which was at (0, 0, 0) but it wasn’t appearing in my Environment Map because the light Probe was all the way at (1000, 0, 1000). So you also need to make sure the camera is nearby the Light Probe when it is generating to capture the sky.

yes, i already make setRadius(1000); for test purpose xd

edit: ok got it working, looks like “enqueue(() → { enqueue(() → {” was anyway too early to make app not null for LightProbeFactory/envCamera.

Scene already looks good. thanks all.

Next question: how to configure blender nodes to make texture transparent? (like poster/text texture). is this possible with current gltf importer?

I don’t know the exact process in Blender, but it sounds like @mitm might be able to help with that since it looks like he’s knowledgeable about setting up the blender nodes so that models export nicely :slightly_smiling_face:

I never learned to use the Blender nodes myself - I just export my models with blank textures, and then I set up all the proper material settings in the SDK’s editor.

But once the PBR model is converted to J3o format, transparency works very similar to the old Phong shader: the material just needs to have “BlendMode” set to “BlendMode.Alpha” and set a BaseColor or BaseColorMap with an alpha channel

1 Like

thanks for info(at least i know PBR got no issue with transparency)

but i need to know if possible via gltf exporter, because every time i will export for example new “hair” so i would like see effect in JME immidietly without alpha setup steps.

or as example i will need have a lot “posters” or sprays on walls that i prefer doing via transparent planes, so i would like have it via blender gltf importer if possible, without playing with setting JME blendMode manually and alpha threshold

if this will be possible, i thought about importing into game directly from .gltf not .j3o

Maybe someone will know, if you say @mitm then i will await his response :slight_smile:

You have to scroll down to the pbr-materials section.
https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md#pbr-materials

Download the pbr example here.

You need these to run it,

I installed mine under pictures/blender/pbr_nodes to make it work.

Haven’t messed with this part yet but I think the jest of it is all you need is an alpha channel and plug it in like so.

copied nodes like you said. I also tried different configuration like alpha cutoff 0,5 alphaMode 1 and mixing this params dont help anything. File dont contain anything about “alpha”

teeeee4
teeeee1

blender render works fine(in material it dont):
teeeee2

JME dont work
teeeee3

Also they say:
“To use ‘MASK’ for blending, the AlphaMode has to be set from 0.0 to 1.0. In this case, as specified by glTF 2.0, the AlphaCutoff value is used and exported.”

i set alphaMode to 1, but then its not exported(at least i dont found in file). its very odd.

they also said “Please note, that separate alpha maps are currently not specified in glTF 2.0 and so not working.”

teeeee5
even managed to make it work in material preview in blender, but also dont work

You need to set
mat.setFloat("AlphaDiscardThreshold", 0.5f); // you should set a float number < 1.0
This is something specific to JME and I think is not imported when loading gltf file.
After loading your model you can traverse all geometries and get materials and set AlphaDiscardThreshold in code.

1 Like

Man that’s funny, I was just looking at that in the definition.

I was going to suggest trying the Specular Glossiness node or generating the material in the SDK and setting seeing what the settings were.

1 Like

looks like gltf is unable to export something like alpha threshold, neither alpha maps.

so if its not possible, and to avoid manual material creation, will just need have png transparent image as albedo and set alpha threshold to EACH geometry(hope it dotn affect fps much) to make it work.

If you use Alpha channel on diffuse and set the image in the material def does it work?

1 Like

You should only need to set alpha discard threshold if transparent pixels are filling the Zbuffer and preventing the opaque parts of other transparent objects that sort after it from rendering.

So my first question when this happens is: why is the opaque object in the transparent bucket?

This is only ever a problem with objects rendered in Bucket.Transparent. Bucket.Opaque objects are always rendered first.

1 Like

everything is fine, i just wanted to know if its possible gltf to export alphaThreshold and JME able to import it correctly.
But it break on first one and gltf file in any case dont contain anything like alpha threshold, it have 4-th param in color(alpha) but its always 1 anyway.

So if its impossible do it just on gltf import, i will do it JME-code way (setting alphaThreshold and Bucket.Transparent). But i will need find way to choose geoms that need to be in Transparent Bucket. (maybe i will check via geom name or whatever) - because i dont want fix transparency manually for like 20 hair styles lets say