Help - CMOD seems to only use first material

Have a question about using Celestia? Check here first for FAQs and helpful advice.
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Avatar
Topic author
LukeCEL
Posts: 359
Joined: 26.09.2017
With us: 3 years

Help - CMOD seems to only use first material

Post #1by LukeCEL » 24.03.2020, 16:27

I'm working on nebulae using CMOD models with sprites. Now I thought that you could just define a bunch of materials at the top, and the nth mesh would use the nth material defined. But that doesn't seem to be the case.

Attached below is a sprite model of Abell 6. In it, I have two materials defined, the first with an opacity of 0.10, the second with an opacity of 0.03. The first mesh (with 882 vertices) is the outer shell, and the second mesh (with 176 vertices) is for the inner gas.
Abell6.png

When I change the second material's opacity from 0.03 to say, 0.15, then nothing changes. Moreover, when I change the first material's opacity from 0.10 to 0.0 (i.e. totally transparent), then all the sprites become fully transparent—the model becomes invisible.

What's going on here? How can I have meshes made from materials other than the first material? I'd like to be able to use different opacities for different point sprites.

Thanks in advance,
LukeCEL
Attachments
Abell6.zip
(28.44 KiB) Downloaded 20 times

Avatar
selden
Developer
Posts: 10138
Joined: 04.09.2002
With us: 18 years 1 month
Location: NY, USA

Post #2by selden » 24.03.2020, 18:44

It looks to me like there's a bug in whatever program you're using to create the CMOD model. Apparently that program is not trying to use the 2nd material (material 1) at all.

In a CMOD model, the first value after the word "sprites" is supposed to be the index value of the material which is be used for the listed vertices. The first material definition is material 0, the second one is material 1.

A grep of the CMOD found two sprite declarations and both of them specify material #0.

A workaround would be to manually edit abell6.cmod to change the second sprites declaration
from
sprites 0 176
to
sprites 1 176

Code: Select all

$ grep -C 3 sprite abell6.cmod
vertices 882
0.026341 0.988471 -0.429339 0.2 0.35 0.7 0.85585

sprites 0 882
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
--
-0.17602 -0.899573 0.153744 0.8 0.25 0.53 0.64
0.430396 -0.437054 -0.41103 0.8 0.25 0.53 0.64

sprites 0 176
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
Selden

Avatar
Topic author
LukeCEL
Posts: 359
Joined: 26.09.2017
With us: 3 years

Post #3by LukeCEL » 24.03.2020, 19:08

selden wrote:In a CMOD model, the first value after the word "sprites" is supposed to be the index value of the material which is be used for the listed vertices. The first material definition is material 0, the second one is material 1.

Ohhh! Thank you for the explanation! I had no idea that the "0" after the sprites refers to the index of the material. (I thought it was just to specify the start of the point sprites, i.e. from 0 to 176. What a goof.)

I'm actually making CMOD models using a combination of programs to automate tasks (such as Microsoft Excel to calculate XYZ coordinates, etc.), and my own editing. So I'll just manually edit the sprite declarations, that'll be quick work.

Once again, thank you selden very much for potentially expanding what I can do with sprites.

Luke

Avatar
selden
Developer
Posts: 10138
Joined: 04.09.2002
With us: 18 years 1 month
Location: NY, USA

Post #4by selden » 24.03.2020, 19:55

Good luck!

I did a quick test after posting my response, and it didn't do what I expected. I probably made a typo of my own somewhere. *sigh*
Selden


Return to “Help Central”

Who is online