On 15-Aug-05, at 11:18 PM, Lo Saeteurn wrote:
Does 3DMF Workshop import the vertex colors?
No, but it should be doable. This would require a bit of work
though, since the Generic3D classes don't take vertex colours into
account at this point. So the core, the importer, and the exporter
would all have to be updated for this to work.
Hmm...Well I guess there's really no way to test if 3DS Max even
exports the vertex colors. I don't want to waste time working on
this to find out that 3DS Max doesn't even export the information.
Is there another program I can use that would show this?
I guess you could export a 3DS from Max, then re-open it to see if
the colours are still there...
I guess a global point light should work just fine at a huge
distance. I do see that it is actually easier to calculate.
All you would do for a directional light is use a constant direction
vector instead of calculating a vector from the light origin to the
vertex. Well that, plus don't attenuate the colour.
What about occluders? How do I calculate if something is blocking
the light?
First you need a method to do a line-triangle collision test (a
Google for "line segment triangle intersection" should turn up a few
algorithms). Then you process each vertex for each light like so:
(psuedo-code)
for each light in world
for each vertex in world.mesh
line = CalculateRay(light, vertex)
addlightcontribution = True
for each triangle in world.mesh
if line.Intersects(triangle) then
addlightcontribution = False
exit
end if
next
if addlightcontribution then
vertex.colour = vertex.colour + CalculateContribution(light,
vertex)
end if
next// Vertex
next// Light
That's the gist of it anyway, you should do a distance test to ensure
a vertex is potentially lit by a light before doing all the triangle
collision tests, and add early rejection tests for vertex normals
that face away from the light, etc.
I don't really mind waiting even an hour to calculating this for a
small sized town.
It would likely be much faster than that (even per-pixel lightmaps
rarely take that long nowadays).
Would it be feasible to use the FindPoint method (of RB3D space) to
test whether a light hits a given vertex? I could point the camera
at a vertex and see if the findPoint returns a value relatively
close to the vertex (test only the z difference from the camera).
Of course I would have to ignore all the objects out of view before
doing the findpoint test.
That could work, but requires that you actually draw the scene a
whole bunch of times, and the accuracy would be questionable when
converting from screen coordinates. It'd probably be faster and safer
to just do the math yourself.
Frank.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|