RodZill4 / material-maker

A procedural textures authoring and 3D model painting tool based on the Godot game engine
MIT License
3.52k stars 222 forks source link

How to affect specular power? #191

Open unfa opened 4 years ago

unfa commented 4 years ago

I haven't found a way to affect the specularity of my material - this is a very important aspect of PBR, that is necessary for many effects like deep holes in a surface or special materials.

For example - here's a little concrete wall material with regular holes in it: image Note that the hole doesn't look like a hole partly because it still has a specular reflection from it's bottom, which completely breaks the illusion.

Is there a way to fix this in Material Maker?

Calinou commented 4 years ago

In Godot, specular power is defined as a global parameter in SpatialMaterial and defaults to 0.5. We'd need a viewport settings menu to be able to configure it.

RodZill4 commented 4 years ago

@unfa do you only need to be able to tune specularity for the material, or do you need to save a specular map for Blender?

It seems to be easy to convert between metalness to specular, and maybe it would be the way to go for some export targets?

Anyway, whatever change we decide, we need to know how it affects exports.

Calinou commented 4 years ago

@RodZill4 Some oldschool game engines like Cube 2 (even in its Tesseract incarnation) still use specular maps, so there might be an argument for exporting specular maps. That said, the viewport won't be able to render it correctly unless it converts the generated specular map back to a roughness/metallic map on the fly.

RodZill4 commented 4 years ago

I didn't intend to generate specular maps before exporting. And the viewport just renders material inputs, so it will never have access to that map.

But even if we wanted to provide an alternate Material node that supports specular PBR, wouldn't it be possible to write a shader to render it?

unfa commented 4 years ago

Hey! Strangely enough - when I made a black spot on the Albedo map the specular reflection has disappeared. I am not sure if that's actually how PBR shaders should work?

In some implementation AO map affects the specularity, but I don't think it should really (if it were to simulate AO, and not... dirt?).

I am a bit confused, I think you understood my question in a way I didn't expect :D

Calinou commented 4 years ago

Hey! Strangely enough - when I made a black spot on the Albedo map the specular reflection has disappeared. I am not sure if that's actually how PBR shaders should work?

Maybe this is related to https://github.com/godotengine/godot/issues/40753?