Crystal Space
Welcome, Guest. Please login or register.
July 24, 2014, 05:55:41 am

Login with username, password and session length
Search:     Advanced search
9005 Posts in 2043 Topics by 8222 Members
Latest Member: Msmarqcarleen03
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Set Smooth: Shader Algorithm or Mesh Construction?
« previous next »
Pages: [1] Print
Author Topic: Set Smooth: Shader Algorithm or Mesh Construction?  (Read 871 times)
Crystalfur
Newbie
*
Posts: 30


View Profile Email
« on: March 02, 2011, 01:56:36 am »

Now, according to the Blender doc, http://wiki.blender.org/index.php/Doc:Manual/Modeling/Meshes/Smoothing, "Activating the smoothing features doesn’t actually modify the object’s geometry; it changes the way the shading is calculated across the surfaces, giving the illusion of a smooth surface."

Does CS have this type of shader or is it all in the mesh construction (vertices, faces)?

When I export a mesh with the solid setting using blender2crystal, I get the vertices I would expect. But when I set smooth in Blender, the mesh gets exported with additional vertices, leading me to believe that it's all in the mesh and not in the shader.
Logged
res
Develazyoper
CS Developer
Full Member
*****
Posts: 206


View Profile Email
« Reply #1 on: March 02, 2011, 02:02:50 pm »

It is, basically, in the construction of the mesh.

IIRC Smoothing affects the _normals_ of the mesh: when enabled, they're computed from combining the normals of neighbouring triangles; when disabled, the triangle normal is simply taken.

Note that CS works differently: it always expects one normal per vertex. Smooth or not smooth looks depend on how the mesh is constructed. (Smooth: a vertex is shared by multiple triangle corners; not smooth: each corner has it's own vertex.)
So it's kind of weird that you get _more_ vertices with smoothing, as typically smoothing means less vertices needed. Can't say what the issue is (maybe a real bug, maybe there is something else that makes the exporter split vertices.)
Logged
Crystalfur
Newbie
*
Posts: 30


View Profile Email
« Reply #2 on: March 03, 2011, 02:44:17 am »

That clarifies things. About b2c's exporting more vertices, I may have been mistaken. I'll check it out when I get back to my desktop.

I'll have to test shared vertices and independant vertices for smooth and solid looks.

Danke
Logged
Crystalfur
Newbie
*
Posts: 30


View Profile Email
« Reply #3 on: March 03, 2011, 08:18:55 pm »

Ugh. I was wrong. You were right.

res++

Alright.. here is the export of a simple cube set to SMOOTH:
Code:
<v x="1" y="-1" z="1" nx="0.577349" ny="-0.577349" nz="0.577349"/>
<v x="1" y="-1" z="-1" nx="0.577349" ny="-0.577349" nz="-0.577349"/>
<v x="-1" y="-1" z="-1" nx="-0.577349" ny="-0.577349" nz="-0.577349"/>
<v x="-1" y="-1" z="1" nx="-0.577349" ny="-0.577349" nz="0.577349"/>
<t v1="3" v2="2" v3="1"/>
<t v1="3" v2="1" v3="0"/>
<v x="1" y="1" z="0.999999" nx="0.577349" ny="0.577349" nz="0.577349"/>
<v x="-1" y="1" z="1" nx="-0.577349" ny="0.577349" nz="0.577349"/>
<v x="-1" y="1" z="-1" nx="-0.577349" ny="0.577349" nz="-0.577349"/>
<v x="0.999999" y="1" z="-1" nx="0.577349" ny="0.577349" nz="-0.577349"/>
<t v1="7" v2="6" v3="5"/>
<t v1="7" v2="5" v3="4"/>
<t v1="1" v2="7" v3="4"/>
<t v1="1" v2="4" v3="0"/>
<t v1="2" v2="6" v3="7"/>
<t v1="2" v2="7" v3="1"/>
<t v1="3" v2="5" v3="6"/>
<t v1="3" v2="6" v3="2"/>
<t v1="5" v2="3" v3="0"/>
<t v1="5" v2="0" v3="4"/>

SOLID:
Code:
<v x="1" y="-1" z="1" nx="0" ny="-1" nz="0"/>
<v x="1" y="-1" z="-1" nx="0" ny="-1" nz="0"/>
<v x="-1" y="-1" z="-1" nx="0" ny="-1" nz="0"/>
<v x="-1" y="-1" z="1" nx="0" ny="-1" nz="0"/>
<t v1="3" v2="2" v3="1"/>
<t v1="3" v2="1" v3="0"/>
<v x="1" y="1" z="0.999999" nx="0" ny="1" nz="-0"/>
<v x="-1" y="1" z="1" nx="0" ny="1" nz="-0"/>
<v x="-1" y="1" z="-1" nx="0" ny="1" nz="-0"/>
<v x="0.999999" y="1" z="-1" nx="0" ny="1" nz="-0"/>
<t v1="7" v2="6" v3="5"/>
<t v1="7" v2="5" v3="4"/>
<v x="1" y="-1" z="1" nx="1" ny="4.47034e-008" nz="-2.83122e-007"/>
<v x="1" y="1" z="0.999999" nx="1" ny="4.47034e-008" nz="-2.83122e-007"/>
<v x="0.999999" y="1" z="-1" nx="1" ny="4.47034e-008" nz="-2.83122e-007"/>
<v x="1" y="-1" z="-1" nx="1" ny="4.47034e-008" nz="-2.83122e-007"/>
<t v1="11" v2="10" v3="9"/>
<t v1="11" v2="9" v3="8"/>
<v x="1" y="-1" z="-1" nx="-2.83122e-007" ny="-1.04308e-007" nz="-1"/>
<v x="0.999999" y="1" z="-1" nx="-2.83122e-007" ny="-1.04308e-007" nz="-1"/>
<v x="-1" y="1" z="-1" nx="-2.83122e-007" ny="-1.04308e-007" nz="-1"/>
<v x="-1" y="-1" z="-1" nx="-2.83122e-007" ny="-1.04308e-007" nz="-1"/>
<t v1="15" v2="14" v3="13"/>
<t v1="15" v2="13" v3="12"/>
<v x="-1" y="-1" z="-1" nx="-1" ny="-1.3411e-007" nz="2.23517e-007"/>
<v x="-1" y="1" z="-1" nx="-1" ny="-1.3411e-007" nz="2.23517e-007"/>
<v x="-1" y="1" z="1" nx="-1" ny="-1.3411e-007" nz="2.23517e-007"/>
<v x="-1" y="-1" z="1" nx="-1" ny="-1.3411e-007" nz="2.23517e-007"/>
<t v1="19" v2="18" v3="17"/>
<t v1="19" v2="17" v3="16"/>
<v x="1" y="1" z="0.999999" nx="2.38419e-007" ny="2.08616e-007" nz="1"/>
<v x="1" y="-1" z="1" nx="2.38419e-007" ny="2.08616e-007" nz="1"/>
<v x="-1" y="-1" z="1" nx="2.38419e-007" ny="2.08616e-007" nz="1"/>
<v x="-1" y="1" z="1" nx="2.38419e-007" ny="2.08616e-007" nz="1"/>
<t v1="23" v2="22" v3="21"/>
<t v1="23" v2="21" v3="20"/>
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.508 seconds with 16 queries.