Coloring CMODs

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
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Coloring CMODs

Post #1by Fenerit » 28.03.2011, 19:46

Hi! In experimenting with the CMOD's colors, I wished to achieve the condition in which several points clouds were differently colored within the same model. And I can achieve that, through the categories below:

Code: Select all

material
end_material

mesh
vertexdesc
position f3
color0 f3
end_vertexdesc
vertices 6
1 0 0 1 0 0
2 0 0 1 0 0
3 0 0 1 0 0
4 0 0 0 0 1
5 0 0 0 0 1
6 0 0 0 0 1

points 0 6
0 1 2 3 4 5
...
mesh
vertexdesc
position f3
color1 f3
end_vertexdesc
vertices 6
7 0 0 1 1 0
8 0 0 1 1 0
9 0 0 1 1 0
10 0 0 1 1 0
11 0 0 1 1 0
12 0 0 1 1 0

points 0 6
0 1 2 3 4 5

where the first three points of the first mesh are reds and the remains are blue and the points of the second mesh are all yellows. The problem what is: is that whether I do set the opacity lesser than 1 in the main material attributes, I do not get the partial translucency of whole model, but just of the second mesh; while the first mesh remains completely opaque, both reds and blue. And it doesn't matter of which numbers of meshes I do add, always the last will be translucent.
In more extent this could be avoided through the insertion of yet the second mesh onto the first as row of points, but should be impossible to achieve targeted traslucency upon point meshes without doing use of new CMODs (one for colors).

At this point the sense of my post.
Reading the CMOD's categories and its definitions on Wiki, I've seen that to the vertex semantic "color0, color1..." is possible to assign the format "ub4", being specified as "four unsigned bytes (the usual format for colors" (from CelestiaWiki - CMODs), at the first sight some kind of way to say RGBA. But trying to add even the alpha to the points rows doesn't work, either in decimal form or in RGB values. In short, is this acknowledged and I'm on the wrong path, having thought with blindness? Thanks in advance anyhow.
Never at rest.
Massimo

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: Coloring CMODs

Post #2by selden » 28.03.2011, 20:36

I don't think Chris has ever provided an example showing how the color0 and color1 attributes are supposed to work. I don't think anyone has tried to use them before, so the code for them might not work.

I always specify the color in a material and then specify that material when I define a "prim_group_type". That way any triangle, point or sprite within a mesh can have any color.
Selden

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: Coloring CMODs

Post #3by Fenerit » 28.03.2011, 21:23

Thanks Selden for reply. The "sequence" color0, color1, color2... works fine indeed as long as any color for point is into a unique mesh. Should be great whether also the opacity for any point were possible to add, since we could achieve good effects. I think at models like the Millennium simulation, your astronomical add-on or similar, in which translucency could play a role, either aestetic or data-related (distances?).

P.S.
FYI, when to the vertex format I add the "color f3" or the "color ub4" and to the points row I set also the supposed (for me) opacity value, I absolutely do not get the crash of Celestia, neither in decimals nor in RGB! 8O . The points there are, but are blacks. I can see them against the galactic background; for that I've posted my concerns: because seems that something at least be working.
Never at rest.
Massimo

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: Coloring CMODs

Post #4by Fenerit » 28.03.2011, 22:28

EDIT LATER:

read "color f4" not "color f3". Sorry.
Never at rest.
Massimo


Return to “Help Central”