Celestia icon indicating copy to clipboard operation
Celestia copied to clipboard

Sprite models used in SSC files ignore opacity

Open LukeCEL opened this issue 4 years ago • 3 comments

This affects 1.6.1, 1.6.2, and 1.7.

CMOD files use a parameter called opacity that affects point sprites. For example, my file abell39.cmod in my Abell 39 add-on has two materials with an opacity of 0.09 and 0.25, respectively. Here's what the beginning of the CMOD file looks like:

#celmodel__ascii
material
   opacity 0.09
   texture0 "27px.png"
   blend normal
end_material

material
   opacity 0.25
   texture0 "27px.png"
   blend normal
end_material

This makes the nebula look like this: normalpndsc

If the opacities are both changed to 1, then the nebula looks like this: opaquepndsc

This works if the model is used in DSC file. However, if it's SSC file, it renders as if the opacities were always 1. Here is an example SSC code that puts the model "abell39.cmod" around HIP 1:

"Shell" "HIP 1"	
{
	Class "diffuse"
	Mesh "abell39.cmod"
	Texture "27px.png"
	# Emissive true
	# Color [0.3 0 0]
	Radius 5e+10	

	EllipticalOrbit {
		Period	1E+12	
		SemiMajorAxis		1E-12	
	}
}

This looks like this: pnssc

LukeCEL avatar Mar 06 '20 00:03 LukeCEL

Okay. I did some testing and it looks like there is a way to get Celestia to use the opacity value in a SSC object. My previous attempt didn't work because I defined a texture in the SSC file, and did not set Emissive to true.

Therefore this SSC code works:

"Shell" "HIP 1"	
{
	Class "diffuse"
	Mesh "abell39.cmod"
	# Texture "27px.png"
	Emissive true
	Radius 5e+10	

	EllipticalOrbit {
		Period	1E+12	
		SemiMajorAxis		1E-12	
	}
}

CorrectOpacity

LukeCEL avatar Jul 04 '20 22:07 LukeCEL

This issue affects the Sagittarius A* addon, even though the sprite models used don't have textures defined in the ssc file, and Emissive true is set. Celestia also becomes extremely slow near the black hole, which may be related. This occurs on 1.7.0 on both Windows and Android, but it does not occur on 1.6.2.

Edit: I guess this is different enough that it's probably not the same bug.

SevenSpheres avatar Dec 15 '21 17:12 SevenSpheres

We need to check shaders for differences. But Please file a separate bug for this. @SevenSpheres

375gnu avatar Dec 15 '21 17:12 375gnu