[2.2] Datablock Transparency json not working

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Lax
Orc
Posts: 476
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

[2.2] Datablock Transparency json not working

Post 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
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4501
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 936
Contact:

Re: [2.2] Datablock Transparency json not working

Post 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

Lax
Orc
Posts: 476
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: [2.2] Datablock Transparency json not working

Post 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
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

paroj
OGRE Team Member
OGRE Team Member
Posts: 1196
Joined: Sun Mar 30, 2014 2:51 pm
x 470
Contact:

Re: [2.2] Datablock Transparency json not working

Post 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

Lax
Orc
Posts: 476
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: [2.2] Datablock Transparency json not working

Post 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
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

Post Reply