GDL
About building parametric objects with GDL.
SOLVED!

Inline defined materials don't appear properly

A_ Smith
Expert

I am confused...

1. same color for a single shape is shown differently.

2. inner 3D view in gdl (during scripting, testing) and general 3D view in project doesn't match.

 

Originally I wanted to define some materials, so despite AC language version or template, objects would look the same. Maybe there's another approach?

 

pen 1
_si=15

define material 'purpleUniqName' 2, 1, 0, 1


define material 'whiteUniqName' 1,
1, 1, 1,! surface RGB [0.0..1.0]
1, ! ambient coefficient [0.0..1.0]
1, ! diffuse coefficient [0.0..1.0]
1, ! specular coeff. [0.0..1.0]
0, ! transparent coeff. [0.0..1.0]
0, ! shining [0.0..100.0]
0 ! transparency atten. [0.0..4.0]

matWhite = IND (MATERIAL, 'whiteUniqName')
matPurple = IND (MATERIAL, 'purpleUniqName')


! material 'purpleUniqName'
! block 1,1,1 ! purple cube OK

add 2,2, 0
REVOLVE{2} 2, 0, 360, 4 + 8 + 256, matWhite, ! NOT OK -> receive purple colour from ABOVE !? if comment those 2 rows
0, 0.5, 0, matWhite, ! if matWhite=18 (instead of inline definition)
2, 0.5, 0, matWhite

add 2, 2, 0
cprism_{3} matPurple, matPurple, matPurple, 0, ! SHOULD be purple prism, though it has white sides
5, 2,
0, 0, 0, _si, matPurple,
0, 1, 0, _si, matPurple,
1, 1, 0, _si, matPurple,
1, 0, 0, _si, matPurple,
0, 0, 0, -1, matPurple

add 2, 2, 0
cprism_{3} matWhite, matWhite, matWhite, 0, ! SHOULD be white cube with yellow top&bottom
5, 2,
0, 0, 0, _si, matWhite,
0, 1, 0, _si, matWhite,
1, 1, 0, _si, matWhite,
1, 0, 0, _si, matWhite,
0, 0, 0, -1, matWhite

! add 2,2, 0
! material 'whiteUniqName'
! block 1,1,1 ! white cube OK


defMat1.pngdefMat2.png
AC 22, 24 | Win 10
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
A_ Smith
Expert

Should have used Cprism{4} and revolve{5} instead

AC 22, 24 | Win 10

View solution in original post

1 REPLY 1
Solution
A_ Smith
Expert

Should have used Cprism{4} and revolve{5} instead

AC 22, 24 | Win 10

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!