Page 1 of 1

[2.2] Datablock Transparency json not working

Posted: Sun Jun 07, 2020 1:38 pm
by Lax
Hi,

during my tests I found out, that datablock transparency does not work anymore when datablock is loaded from json file. I have the following datablock:

Code: Select all

"HollowSphere" :
		{
			"macroblock" : "Objects_Macroblock_0",
			"blendblock" : "Objects_Blendblock_0",
			"shadow_const_bias" : 0.01,
			"workflow" : "specular_fresnel",
			"transparency" :
			{
				"value" : 0.6,
				"mode" : "Fade",
				"use_alpha_from_textures" : false
			},
			"diffuse" :
			{
				"value" : [1, 1, 1],
				"background" : [1, 1, 1, 0.6]
			},
			"specular" :
			{
				"value" : [1, 1, 1]
			},
			"fresnel" :
			{
				"value" : 0.7
			}
		}
Its transparency ist set to "Fade". When I load the sphere, its not transparent. But If I set the transparency value of 0.6 or the transparency mode again in Code:

Code: Select all

datablock->setTransparency(...)
It will become transparent again.

Best Regards
Lax

Re: [2.2] Datablock Transparency json not working

Posted: Sun Jun 07, 2020 5:12 pm
by dark_sylinc
Sounds like Objects_Blendblock_0 is incorrectly defined?

setTransparency( .., Fade, .. ) will mess with the blendblock (which is required for properly setting up fading), but if the material already explicitly provides a blendblock then it won't mess with it and respect whatever the explicit blendblock says.

This behavior is so in order for proper serialization being possible.

Cheers

Re: [2.2] Datablock Transparency json not working

Posted: Mon Jun 08, 2020 11:19 am
by Lax
Hi dark_sylinc,

hm I do not know what could be wrong with the blend block:

Code: Select all

"blendblocks" :
	{
		"Objects_Blendblock_0" :
		{
			"alpha_to_coverage" : false,
			"blendmask" : "rgba",
			"separate_blend" : false,
			"src_blend_factor" : "one",
			"dst_blend_factor" : "zero",
			"blend_operation" : "add"
		}
	},
Best Regards
Lax

Re: [2.2] Datablock Transparency json not working

Posted: Mon Jun 08, 2020 2:38 pm
by paroj
Lax wrote:
Mon Jun 08, 2020 11:19 am
Hi dark_sylinc,

hm I do not know what could be wrong with the blend block:
it does no blending?
https://ogrecave.github.io/ogre/api/lat ... ml#details

Re: [2.2] Datablock Transparency json not working

Posted: Mon Jun 08, 2020 3:30 pm
by Lax
Hi,

ok it was not obvious, which parameter must be adapted. But this result made the trick:

Code: Select all

"Objects_Blendblock_Transparent_0" :
		{
			"alpha_to_coverage" : false,
			"blendmask" : "rgba",
			"separate_blend" : false,
			"src_blend_factor" : "src_alpha",
			"dst_blend_factor" : "src_alpha",
			"blend_operation" : "add",
			"blend_operation_alpha" : "add"
		}
Thanks!

Fore completeness: Here I found which paramters are possible viewtopic.php?t=84573
Maybe the given parameters could also be added to docu? Because its no obvious what can be configured.

Best Regards
Lax