KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.49k stars 317 forks source link

Spec/gloss PBR materials #52

Closed julienduroure closed 4 years ago

julienduroure commented 6 years ago

Check if this is possible, and implement if it is.

emackey commented 6 years ago

The Blender Principled shader is using the metal/rough model, not spec/gloss. It does have a monochrome specular input, but that's not what you're looking for here.

I don't know of any way to support KHR_materials_pbrSpecularGlossiness import in Blender without a rather complex node tree. There's more discussion in https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/222, and someone even made a new working node tree in https://github.com/KhronosGroup/glTF-Blender-Exporter/pull/225.

julienduroure commented 5 years ago

Closing for now, seems this is not possible to use Principled shader for KHR_materials_pbrSpecularGlossiness

emackey commented 5 years ago

Just an update on this, no action needed yet.

Blender 2.80 Beta documentation lists Eevee-only Nodes that do not work in Cycles. One of these nodes is a Specular BSDF node exclusively for realtime Eevee.

This node offers the Spec/Gloss workflow, in particular offering a full-color Specular channel. It has a "roughness" channel instead of gloss, but a simple invert node can fix that.

Interestingly, it also has a dedicated input channel for baked ambient occlusion (but only for the spec/gloss workflow, not metal/rough).

donmccurdy commented 5 years ago

From the docs:

It is similar to the Principled BSDF node but uses the specular workflow instead of the metallic. It has much less parameters and supports less features. Both might be merged into one node in the future.

Interesting.. 🤔I'm tempted to open an issue on Blender asking about the baked AO input issue. Not sure why they'd put it on their "less features" node but not Principled BSDF.

donmccurdy commented 5 years ago

Just an update on this, no action needed yet.

@emackey any particular reservations about implementing this (import + export)? May be good to ask about Blender devs' plans but otherwise I think I'm in favor.

emackey commented 5 years ago

I tested out the node, and it could certainly be used to implement import/export, including the AO channel.

One small wrinkle is that the node doesn't use the max specular component, as discussed in https://github.com/KhronosGroup/glTF/issues/1443. For example, if one sets a lime-green diffuse color and a solid-red specular color, in Blender you'll see a green diffuse object with red specular highlights, but, in glTF, you should just see a metallic red object (with the diffuse green zeroed out by that max statement). Looks to me like there's disagreement across the wider ecosystem on what to do about this, I'll have to update my notes in the other issue. But I don't think those concerns affect the mechanics of importing and exporting via this node, so, I'm OK to re-open this.

donmccurdy commented 5 years ago

Reopened. @julienduroure does it seem OK if I open an issue on the Blender tracker to ask about plans for this and AO? Or is there a better way to contact them?

julienduroure commented 5 years ago

Best way is to write on https://devtalk.blender.org/ and/or by email on mailing list bf-committers@blender.org. Tracker is only for bugs, not for discussions / requests.

donmccurdy commented 4 years ago

I'll close this again. It doesn't seem like we have any plans to support the Specular BSDF node right now, and the AO questions are discussed elsewhere.

elfprince13 commented 1 year ago

@so-rose - can you post some of the sample models you used in working on KhronosGroup/glTF-Blender-Exporter#222 and KhronosGroup/glTF-Blender-Exporter#225 and maybe the screenshot comparing the BabylonJS + Cycles results you got? I have a glTF file that seems pretty washed out in Blender + but looks phenomenal in BabylonJS, and the current spec/gloss node import still looks kind-of sus to me.

so-rose commented 1 year ago

@elfprince13 Hm it's a while ago, but I didn't use any special model - just a UV sphere under a standard sky, with an area light casting shadows onto a plane.

If it's a supported material, I'd double check the Blender color management settings. See https://docs.blender.org/manual/en/latest/render/color_management.html

Blender's color management defaults to "Filmic", which tonemaps a large dynamic range with desaturation in the highlights. If you import a texture and render it under basic lighting, it will thus look washed out. You can up the contrast in the Color Mamagement menu, to match expectations associated with photography better. I'm guessing that's what's going on here.

In general, the key is to design your scene with physics in mind, not from what your texture "looks" like; use light intensities comparable to the real world, use the Principled Shader, and prioritize monitoring the saturation of textures. Treat it like a film set more than a CG scene, and Filmic will tend to treat you well.

If you really want to, you can also flip Blender's output back to sRGB. This should again result in a render of the texture as encoded.

glTF requires JPG/PNG textures encoded as sRGB. It's also a good sanity check to make sure that's a thing.