Jump to content

API Materials Migrating to 2.15


photo

Recommended Posts

Hi,

Could you please detail how to replace this from 2.14 to 2.15:

// 2.15: setPostMaterials is not part of PlayerSpectator
spectator->setPostMaterials("vr_post_filter_selection");

// 2.15: findMaterial is not part of Materials
Materials::findMaterial("abcd") // "abcd" is based on mesh_base

Thanks!

Link to comment

Hi Amerio.Stephane,

Post materials were removed, you use Scriptable Materials instead as a more flexible replacement. That involves updating both shaders and materials, we recommend to upgrade old XML Basemat's to ULON format for future, as we plan on removing XML Basemats in 2.16.

Instead of setPostMaterials use addScriptableMaterial.
Instead of Materials::findMaterial("abcd") use Materials::findMaterialByPath (requires full path to the file with file extension) or findMaterialByGUID.

API Migration Guide

Regarding fastest changes that can be done to materials/shaders:
1. Ensure that you use full paths to shader files, instead of just file names
2. We removed auto (& renamed) MRT/Render Target declarations in 2.15. Declare them explicitly:

STRUCT_FRAG_BEGIN
	INIT_COLOR(float4)
STRUCT_FRAG_END

3. Use new path to base shader includes:
core/shaders/common/common.h -> core/materials/shaders/render/common.h
and others

4. Make sure that you use correct shader body declarations:

MAIN_BEGIN(VERTEX_IN, FRAGMENT_IN)
MAIN_END

MAIN_FRAG_BEGIN(FRAGMENT_IN)
MAIN_FRAG_END

MAIN_COMPUTE_BEGIN(x, y, z)
MAIN_COMPUTE_END

MAIN_EVALUATE_BEGIN(EVALUATE_OUT, EVALUATE_IN)
MAIN_EVALUATE_END

MAIN_CONTROL_BEGIN(CONTROL_OUT, CONTROL_IN)
MAIN_CONTROL_END

MAIN_PATCH_CONSTANT_BEGIN(CONTROL_IN)
MAIN_PATCH_CONSTANT_END


 

  • Like 1
  • Thanks 1
Link to comment
×
×
  • Create New...