[sldev] Sculpted prim works in progress
John Hurliman
jhurliman at wsu.edu
Mon Apr 30 18:12:26 PDT 2007
You will need Windows XP or Vista, and the XNA Game Studio Express
(available at http://msdn2.microsoft.com/en-us/xna/default.aspx). That's
just the main code file so you'll have to setup a new "Windows Game"
project and copy paste the code in to Game1.cs or whatever the generated
file is called. I didn't put too much effort in to packaging up a full
solution package and binaries because I'm still poking at it, adding
normal calculations for lighting and UV coords for texturing, and will
probably switch to using WinForms so you can open new files and add an
export to OBJ option.
I actually only created this previewer program to try out my other
program, a generic OBJ to position map converter. It seemed like a good
idea on the whiteboard but in practice it only works for certain shapes
that would be much easier to just create with NURBS in the first place.
Maybe some clever programmers can help out with it or offer tips on
improving it. The basic idea is shown in this screenshot of the program:
http://www.jhurliman.org/images/positionmapper01.png
An OBJ file is loaded, a bounding sphere is created around it, and 4096
(64x64) points are iterated over on the surface of the sphere. From each
point a ray is drawn towards the origin and collision tested with mesh,
and the point of collision is converted to an RGB value in the output
image. It worked great for a simple cube (although there was some
interesting distortion taking a spherical sampling of a cube), but the
blockhead example highlighted obvious problems. The inner ring
projecting towards the origin shot up between his legs, almost to
<0,0,0>, but the next ring outwards hit his legs, and two or so more
rings out hit way up on his legs, so he ended up with very distorted
spiky legs and way too many points near the origin. Basically a sampling
problem as 1) only 4096 total samples are taken, and 2) the spherical
mapping puts a heavy bias near the poles and thins out near the equator.
It would work decently well if the mesh was a ball of clay or something
like that, but then why not just work on an exporter for the program you
created it in instead? It was a fun experiment at least, I will revisit
it if anyone thinks up some ideas on how to improve it.
John Hurliman
Zak Escher wrote:
> How do you build this program?
>
> On 4/29/07, John Hurliman <jhurliman at wsu.edu> wrote:
>> I got the MEL script for creating the sculpted prim textures working but
>> had no way to test if I did it right or not, so I wrote this:
>>
>> http://www.jhurliman.org/images/sculptedpreview03.png
>>
>> It's a C# XNA app, code is attached. One thing that I noticed was my own
>> position maps (is there a better name for them? that's what I've been
>> calling the textures) create geometry virtually identical to what I see
>> in Maya, but the ones I downloaded off of flickr appear to suffer from
>> slight JPEG compression artifacts. Will we be able to upload the
>> position maps using lossless JPEG2000 settings? Even the raw image files
>> only take up ~12.5KB.
>>
>> John Hurliman
More information about the SLDev
mailing list