Crystal Space
Welcome,
Guest
. Please
login
or
register
.
June 20, 2013, 08:24:32 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9262
Posts in
2263
Topics by
5444
Members
Latest Member:
Summonermw2
Crystal Space
Crystal Space Development
General Crystal Space Discussion
Problem with polygon normals and lighting
« previous
next »
Pages:
[
1
]
2
Author
Topic: Problem with polygon normals and lighting (Read 5515 times)
rvhaasen
Jr. Member
Posts: 62
Problem with polygon normals and lighting
«
on:
September 01, 2006, 05:21:56 pm »
Situation:
my model is a room with one object and 1 static light, modelled with 3dsmax and exported with the planeshift exporter.
Viewed with walktest.
Problem
The room looks ok, the lighting on the walls are as expected. However, about 50% of the triangles of the object in the room
look very dark: the texturing is ok for (although as mentioned very dark).
The effect looks "as if the normal of the triangle that has been for the calculation of the lightmap has flipped": those triangles have the
same "darkness" as the part of the object that is not facing the light.
Another observation is that this problem occurs mainly on the side of the object that is facing the light.
When i export the model with "LIGHTING=no" in the problematic object, it looks as expected, textured without lighting,
so i would guess that the problem is not in the exported map file (?)
does anyone have an idea what could be wrong here?
Rick
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #1 on:
September 01, 2006, 05:27:34 pm »
Could you show me a screenshot?
Also version of CS, operating system and 3D card+driver.
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #2 on:
September 01, 2006, 08:02:54 pm »
i forgot to be more clear about that....
CS version 0.99 pseudo static release
WinXP SP2
Graphics card: Nvidia QuadroFX3000
(and i did use the -relight option)
It's a system at the office, i will not be there before Monday
so i will post a screenshot then.
Rick
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #3 on:
September 04, 2006, 11:22:38 am »
i reduced the object to 2 triangles,
The lightsource is located "behind the camera".
In the worldfile the simplified object now looks as follows:
<meshobj name="Female Shoe01">
<plugin>thing</plugin>
<priority>object</priority>
<zuse />
<params>
<v x="5.34168" y="0.994367" z="-6.0481" />
<v x="5.32998" y="1.00782" z="-6.04031" />
<v x="5.34632" y="0.941973" z="-5.97144" />
<v x="5.32241" y="1.03797" z="-6.0721" />
<material>Grass2.jpg</material>
<p name="Female Shoe01_1"> <v>3</v><v>1</v><v>0</v>
<texmap><uv idx="0" u="0.838139" v="0.0944298" /><uv idx="1" u="0.746744" v="0.235147" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
<p name="Female Shoe01_2"> <v>1</v><v>2</v><v>0</v>
<texmap><uv idx="0" u="0.746744" v="0.235147" /><uv idx="1" u="0.548769" v="0.542497" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
</params>
</meshobj>
I attached 2 pictures, 1 with and the other without lighting on the "2 triangle object".
btw, the triangles are co-planar.
sim.gif
(48.01 KB - downloaded 194 times.)
simnl.gif
(48.08 KB - downloaded 188 times.)
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #4 on:
September 04, 2006, 11:25:43 am »
Hmm and when do the two screenshots occur? I mean when do you get the first and when the second?
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #5 on:
September 04, 2006, 11:44:43 am »
I did the following:
- exported the scene with LIGHTING=yes as object property the "2 triangle object"
- executed the aplication, manouvred to the location
- then i took a screenshot
for the other screenshot i did the same, but now with "LIGHTING=no"
Rick
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #6 on:
September 04, 2006, 11:45:33 am »
Strange. And you did use -relight to calculate the lightmaps?
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #7 on:
September 04, 2006, 12:07:04 pm »
yes, i relight the scene every run.
To be sure, i just removed the "chache" directory.
The run does generate the lightmaps
But is did another experiment with interesting results:
If i scaled the object (about 10x the size), now the result looks "good"
If i scaled the object (.1x the original size) the object is completely dark!
So it looks that there is a relation with the size of the triangles
Rick
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #8 on:
September 04, 2006, 12:11:18 pm »
Ah. How are you scaling the object exactly? You should be careful with scaling through <move> or iMovable as CS doesn't support that. Only hardmove or HardTransform is supported.
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #9 on:
September 04, 2006, 12:21:05 pm »
I did the scaling from 3dsmax, just selected the object, scaled it by some amount
and exported it again.
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #10 on:
September 04, 2006, 12:21:45 pm »
Quote from: rvhaasen on September 04, 2006, 12:21:05 pm
I did the scaling from 3dsmax, just selected the object, scaled it by some amount
and exported it again.
Hmm... Then it depends on what the 3dsmax exporter does with this. Not sure here.
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #11 on:
September 04, 2006, 12:30:49 pm »
The only thing that is different in the exported file is the actual position of the 4 vertices:
<meshobj name="Female Shoe01">
<plugin>thing</plugin>
<priority>object</priority>
<zuse />
<params>
<v x="-0.0305882" y="1.01296" z="-6.1594" />
<v x="-0.0918085" y="1.08329" z="-6.11869" />
<v x="-0.00635411" y="0.739024" z="-5.75863" />
<v x="-0.13135" y="1.24092" z="-6.2849" />
<material>Grass2.jpg</material>
<p name="Female Shoe01_1"> <v>3</v><v>1</v><v>0</v>
<texmap><uv idx="0" u="0.838139" v="0.0944298" /><uv idx="1" u="0.746744" v="0.235147" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
<p name="Female Shoe01_2"> <v>1</v><v>2</v><v>0</v>
<texmap><uv idx="0" u="0.746744" v="0.235147" /><uv idx="1" u="0.548769" v="0.542497" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
</params>
</meshobj>
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #12 on:
September 04, 2006, 12:31:58 pm »
Well I have no clue I'm afraid. I can see no reason for this failing.
Greetings,
Logged
rvhaasen
Jr. Member
Posts: 62
Re: Problem with polygon normals and lighting
«
Reply #13 on:
September 04, 2006, 01:47:48 pm »
Jorrit, in any case, many thanks for your lighting fast respons!
If you would have some time: i reduced the world file to the bare minimum (84 lines) in order to see the effect,
It only needs 1 texture which is attached (stucco.jpg).
If you move around, you will see the 2-triangle object which has 1 good and 1 bad lighted triangle.
I also took a screenshot of how i see it with walktest
Rick
------------
<world>
<variables>
<variable name="lightning reset"><color red="0" green="0" blue="0"/></variable>
<variable name="LodM" value="-0.00666667" /><variable name="LodA" value="1.33333" />
</variables>
<textures>
<texture name="Stucco.jpg"> <file>Stucco.jpg</file></texture>
</textures>
<materials>
<material name="Stucco.jpg"> <texture>Stucco.jpg</texture></material>
</materials>
<plugins>
<plugin name="thing">crystalspace.mesh.loader.thing</plugin>
<plugin name="thingFact">crystalspace.mesh.loader.factory.thing</plugin>
<plugin name="meshFact">crystalspace.mesh.loader.factory.genmesh</plugin>
<plugin name="mesh">crystalspace.mesh.loader.genmesh</plugin>
</plugins>
<settings><clearzbuf>yes</clearzbuf><ambient red="0.1" green="0.1" blue="0.1" /><lightmapcellsize>32</lightmapcellsize></settings>
<sector name="main">
<cullerp>crystalspace.culling.dynavis</cullerp>
<meshobj name="room">
<plugin>thing</plugin>
<priority>object</priority>
<zuse />
<params>
<v x="-0.78544" y="0.0" z="-8.83142" />
<v x="9.21456" y="0.0" z="-8.83142" />
<v x="-0.78544" y="0.0" z="1.16858" />
<v x="9.21456" y="0.0" z="1.16858" />
<v x="-0.78544" y="3.0" z="-8.83142" />
<v x="-0.78544" y="3.0" z="1.16858" />
<material>Stucco.jpg</material>
<p name="room_1"> <v>2</v><v>3</v><v>0</v>
<texmap><uv idx="0" u="0.00249848" v="-8.995" /><uv idx="1" u="4.9975" v="-8.995" /><uv idx="2" u="0.00249743" v="0.995003" /></texmap>
</p>
<p name="room_2"> <v>1</v><v>0</v><v>3</v>
<texmap><uv idx="0" u="4.9975" v="0.995005" /><uv idx="1" u="0.00249743" v="0.995003" /><uv idx="2" u="4.9975" v="-8.995" /></texmap>
</p>
<p name="room_3"> <v>0</v><v>4</v><v>2</v>
<texmap><uv idx="0" u="0.00249848" v="0.9995" /><uv idx="1" u="0.00249848" v="0.000499547" /><uv idx="2" u="4.9975" v="0.9995" /></texmap>
</p>
<p name="room_4"> <v>4</v><v>5</v><v>2</v>
<texmap><uv idx="0" u="0.00249848" v="0.000499547" /><uv idx="1" u="4.9975" v="0.000499547" /><uv idx="2" u="4.9975" v="0.9995" /></texmap>
</p>
</params>
</meshobj>
<meshobj name="Female Shoe01">
<plugin>thing</plugin>
<priority>object</priority>
<zuse />
<params>
<v x="2.86494" y="1.51019" z="-6.0481" />
<v x="2.85323" y="1.52365" z="-6.04031" />
<v x="2.86957" y="1.4578" z="-5.97144" />
<v x="2.84566" y="1.55379" z="-6.0721" />
<material>Stucco.jpg</material>
<p name="Female Shoe01_1"> <v>3</v><v>1</v><v>0</v>
<texmap><uv idx="0" u="0.838139" v="0.0944298" /><uv idx="1" u="0.746744" v="0.235147" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
<p name="Female Shoe01_2"> <v>1</v><v>2</v><v>0</v>
<texmap><uv idx="0" u="0.746744" v="0.235147" /><uv idx="1" u="0.548769" v="0.542497" /><uv idx="2" u="0.766824" v="0.297936" /></texmap>
</p>
</params>
</meshobj>
<light name="Omni02main">
<attenuation>none</attenuation>
<center x="6.83038" y="1.9381" z="-6.99488" />
<radius>200.0</radius>
<color red="1.0" green="1.0" blue="1.0" />
</light>
</sector>
<start name="Camera01"><sector>main</sector><position x="3.23992" y="1.75079" z="-6.54786" /></start>
<sequences>
</sequences>
<triggers>
</triggers>
</world>
STUCCO.JPG
(43.93 KB - downloaded 179 times.)
siim2.gif
(51.25 KB - downloaded 172 times.)
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problem with polygon normals and lighting
«
Reply #14 on:
September 04, 2006, 01:53:37 pm »
Yes I can reproduce it. But I still don't know what causes it. Looks like a bug in the lightmapper. We're going to have a new lightmapper in the future anyway.
Greetings,
Logged
Pages:
[
1
]
2
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...