Page MenuHome

Blender Internal: Add material properties "Emit Color" and "Ambient Color".
AbandonedPublic

Authored by Shinsuke Irie (irie) on Feb 9 2014, 2:47 PM.

Details

Summary

"Emit Color" specifies emission color not depending on the diffuse color. "Ambient Color" modifies a color of the global ambient light that each material receives, and is used for the environment lighting instead of the diffuse color. If the ambient color is enabled, material preview uses global ambient color=(0.7, 0.7, 0.7) to get better preview.

These properties should be quite useful for NPR. I tried some test renders and indeed got much nicer results:

https://plus.google.com/108666457756457924138/posts/3NaXutjuypj
https://plus.google.com/108666457756457924138/posts/EXcXGNKjvMq

Also, this allows several importers/exporters to provide better support for materials.

The following things need further modifications:

  • Game Engine
  • COLLADA support
  • Addons (importer/exporter and so on)
  • startup.blend (material of the default cube)

I'm not sure if BLENDER_SUBVERSION should be bumped up.

Diff Detail

Branch
material_emit_amb_colors

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.Feb 10 2014, 3:09 PM

The options seems ok to me in general, some comments.

release/scripts/startup/bl_ui/properties_material.py
362–374

The UI convention is to avoid hiding these color properties if they are not used, rather they should show disabled (row.active = False).

source/blender/blenkernel/intern/material.c
123

I would expect the ambient color to be initialized to the same value as the diffuse color, as that is the somewhat more physically correct thing to do.

1013–1017

The amb parameter should be removed from all these functions if it is no longer used.

1052

Why put this outside the if () {} when mode_l is inside it?

1066–1074

Again it's not clear to me why mode2_l is handled different than mode_l, seems like that makes things more confusing.

source/blender/gpu/intern/gpu_material.c
1465

This optimization to skip the ambient light when the material does not use it got lost in the change?

source/blender/render/intern/source/shadeoutput.c
1956–1960

This seems like an assumption that may not work well in general? It seems like it's kind of making the assumption that if you are using this option then you're using it for NPR like rendering or so.

Note, I added a patch for ambient color years ago, but Ton rejected (because he didn't think this was a good idea, IIRC code was OK).

The way I had it work was you could slide between world ambient and material's own ambient, which IMHO allows for more control integrating into the existing scene, rather then having a toggle. (sorry can't find patch, but this would be from ~2006 - at a guess)