tom.drastic.net

diego on e

diego1.jpg

Read the rest of this entry »

April 12th, 2008 | demo, vsys, 3d | 1 Comment »

maxscript…

“snapshotAsMesh object” gives you the current object completly collapsed.
bad thing is, the transform matrix is also applied, so all vertices are in world space.
get the vertices back into local space, you multiply every vertex with the inverse transformation matrix:

  mesh = snapshotAsMesh obj
  worldTransform = obj.transform
  invWorldTransform = inverse worldTransform 

  for v = 1 to mesh.numverts  do
  (
    vert=getVert mesh v
    vert*=invWorldTransform -- daadaaa
    WriteFloat f vert.x
    WriteFloat f vert.y
    WriteFloat f vert.z
  )

for your normals you have to do the same, just multiply with the inverse world matrix. but only use rotation this time.

do not use obj.mesh directly to get object space vertex coordinates, or your script will become unbelivable slow…..

April 12th, 2008 | maxscript, dev, 3d, 3dsmax | No Comments »

random maxscript questions

just some random questions i had when starting with a maxscript exporter…

how do i read animated values ?
for printing an object position at time T, do:

print at time T obj.pos.x

getting information about scene animation

animationrange.end
animationrange.start

what is the current framerate ?
use the global variable “frameRate”

how do i rewind or set the max timeline?
use the global variable sliderTime to set it.

sliderTime =0

how to get vertex normals ?
this way your normals look like you wanted them. (”smoothing groups safe”)

for ve = 1 to mesh.numfaces do
(
    norm=meshop.getFaceRNormals mesh ve
    format "% % %" norm[1].x norm[1].y norm[1].z
    format "% % %" norm[2].x norm[2].y norm[2].z
    format "% % %" norm[3].x norm[3].y norm[3].z
)

what is the color i set at rendering->environment->background color ?
use the global variable “backgroundColor” :)

how to test if an object is animated ?
you can check (boolean) “obj.isanimated”.
i think this works not if vertices of the object are animated. only if position/rotation/etc. are animated..
also this is false if the object is linked to a bone, which is animated!

April 10th, 2008 | maxscript, dev, 3d, 3dsmax | No Comments »

baking mesh animations using point cache

i use the collada file format for importing 3d objects into my “system”.
nice thing of the collada file format is, it contains informations about animations.
but those animations are only for whole objects, not for vertex data.
if you use it for displaying robots or bone/skin stuff this is ok.
but you can not use it for baking complex animations created in 3ds max.

3ds max has the point cache modifier for objects.
this modifier exports baked and sampled animations to a file.
which is exactly the feature collada is missing.
so you can bake mesh animations for your object and read the exported files in your engine.

using the point cache modifier

1. create your animation using for example the twist modifier on an object
2. put the point cache modifier on top of the modifier stack
3. press record, enter file name and you are done
4. the button “disable modifiers below” you can turn of the animation modifier, now play the animation and you’ll se the sampled animation.

point cache pc2 file format

the exported pc2 files contain simple information about the animation and a big chunk of sampled vertex data.
i found a description of the format here

char    cacheSignature[12];   // Will be 'POINTCACHE2' followed by a trailing null character.
int     fileVersion;          // Currently 1
int     numPoints;            // Number of points per sample
float   startFrame;           // Corresponds to the UI value of the same name.
float   sampleRate;           // Corresponds to the UI value of the same name.
int     numSamples;           // Defines how many samples are stored in the file.

this is the header information.
after that the vertex data follows as floats (3 floats for a vertex):

numSamples*numPoints*3

February 27th, 2008 | dev, howto, 3d, 3dsmax | No Comments »

new vsys gui

newgui4jpg.jpg
expect more soon :D

Read the rest of this entry »

February 10th, 2008 | gui, 2d, vsys | No Comments »

vsys splines

outlinedetect.jpg

February 2nd, 2008 | gui, vsys, 3d | No Comments »

3ds max / mudflow normal map workflow

i use this for realtime graphics, so i am ignoring creation of displacement maps, just focus on normal map generation.

building basic model in 3dsmax

- build a model / use subdivision
- unwrap model for later normal map texture coordinates

importing model into mudbox

- export model from 3ds max as .obj file
- import model into mudbox
- subdivide (shift-d) to a higher level, e.g. level 3
- paint your stuff onto it.

getting your normal map into 3ds max

- choose utilities->texture baking
- select “low resolution mesh”: “[modelname] level 0″
- select high resolution mesh: “[modelname] level [highest number]”
- activate “create normal map”, choose filename
- deactivate “create displacement map”
- open advances settings
- enable smooth UV’s
- choose preset “3dsmax”
- start map baking process
- switch to 3ds max
- open the material editor
- goto “maps”
- click “none” next to “bump”
- choose “normal bump”
- select your image file you exported from mudbox
- finished

mudboxnmap.jpg

this is the original version (~4000 faces) and the result after setting the normal map.
its far from being finished and the uvw map is really crappy, but you’ll get the idea…

misc:
check the great mudbox tutorials at pixelcg.com/

January 20th, 2008 | bump map, normal map, mudbox, 3d, 3dsmax | 1 Comment »

exospect demo

exospec.png
demo at tum 2007: exospect (made 4th place)

  • download win32 version (requires java 1.6) here
  • download mac os x version (use 0x multisampling on intel graphic chips) here
  • download jar only version here
  • pouet demo experts discussion here
  • video (xvid) download here

Read the rest of this entry »

January 1st, 2008 | demo, vsys, 3d | No Comments »

flash papervision experiments

my first flash+papervision 3d depth of field (DOF) experiment:

papervision.jpg
(to see the flash version click “read more”…)

  1. bluring (or fake dof if you want) is done by calculating the distance of every plane to the “current” plane.
  2. animations are done using tweener, which is a really nice tool to animate/keyframe numeric values.
    check this nice tutorial on tweener…
  3. pictures are taken from stephans asia journey on piclog

Read the rest of this entry »

October 24th, 2007 | papervision, flash, 3d | 2 Comments »

mediawiki run php code

you can run php code in mediawiki using the runphp extension.
you can get it here

i used it to display some database content. but it did only update after re-saving the article.
you need to disable caching in mediawiki:

$wgMainCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_NONE;
$wgParserCacheType = CACHE_NONE;
$wgCachePages = false;

(taken from: here)

when accessing a database:

  1. do not use $handle
  2. do not use select_db() just use absolute database and table names, like “select * from databasename.tablename”

other problems:

  1. include the runphp file AT THE END OF localsettings.php, not at the beginning……..
  2. runphp only executes php from protected (sysop only) pages!
October 19th, 2007 | php, mediawiki, wiki | 2 Comments »

delete files older than x days

to delete files that are older than x days on your linux server, you can use:

find /path/*.gif -mtime +1 -exec rm {} ;
October 19th, 2007 | linux | 1 Comment »

timelapse of modeling an insect like thing

recorded a small modeling session in 3ds max, creating an insect. original time was 22 minutes.
the whole thing is basically done using the box modeling method, just using the tools extrude / bevel / quick slice.

August 22nd, 2007 | 3d, 3dsmax | 1 Comment »

import sketchup to 3ds max

there is that wonderful xml format digital assets exchange (.dae) format called collada.
google earth models (.kmz) contain the mesh information as a dae file.

this also works with the free version of sketchup!

what you have to do is get that .dae file out of the .kmz and import it into 3ds max.
a kmz file is basicaly a zip file, which contains the model and textures and information on where on earth the model should be placed etc..

  1. export your sketchup scene as “3d model” - “google earth x (*.kmz)”
  2. find the file and rename it to “.zip”
  3. unzip the content of the file
  4. open max - choose “file” - “import” - choose “dae” file format, and open your file

perhaps max says something like:

    -Warning: Meter conversion factor is too small or invalid: 0.01

there is a way to change this:

open the .dae file in your favorite text-editor.

  • find the line:
    <unit name="centimeters" meter="0.01"/>
  • relpace “0.01″ with something bigger, like “1.00″
  • save the file
  • now you should be able to import the scene into 3ds max

i used 3ds max v9 for it and this collada importer , but there should be free collada importer for earler versions of max and nealry every other 3d tool like maya or blender etc…

August 19th, 2007 | howto, 3d, sketchup, 3dsmax | 7 Comments »

how to use png textures with alpha channel in max

you can use one png file as diffuse color map and transparency map at the same time. so you don’t need to create 2 files for this in 3ds max.

  1. create your transparent texture
  2. save as 24bit png file
  3. switch to max, open the material editorm choose an empty slot
  4. choose “maps”
  5. click the “none” button next to “diffuse color”
  6. select “bitmap” and choose your png file
  7. go back to the material editor (e.g. “03 - default”in the pulldown menu under the material slots)
  8. click the “none” button next to “opacity”
  9. select “bitmap” and choose the same png file
  10. switch “mono channel output” to “alpha” (in “bitmap parameters”)
August 19th, 2007 | 2d, howto, 3d, 3dsmax | 12 Comments »

vsys svn checkout

checking out vsys project from svn into eclipse

1. setting up svn in eclipse

  1. install eclipse 3.x
  2. install subclipse as described at http://subclipse.tigris.org/install.html
  3. goto “window” -> “open perspective” -> “other” -> “svn repository exploring”
  4. right click into “SVN Repository” then “new”->”repository location”
  5. url: https://admin.neonature.net/svn_vsys/
  6. go back to perspective “java (default)”

2. checking out project from svn

  1. right click on package explorer
  2. select “new”->”svn”->”checkout project from svn”
  3. choose svn://svn.5711.org/projects/vsys
  4. choose “trunk” -> “vsys”+highest number
  5. click next
  6. check “check out as a poject configured using the new project wizard”
  7. click finish
  8. select “java project”
  9. click next
  10. enter project name
  11. project layout: “use project folder as root…”
  12. click finish

3. getting vsys compiled

  1. right click the project in the package explorer, select “properties”
  2. select java build path
  3. choose tab “source”
  4. click “add folder”
  5. check “plugins” and “vsys”
  6. click “yes” when asking to remove source folder
  7. click ok
  8. click “yes” when asking to remove old resources
  9. right click the project in the package explorer, select “properties”
  10. select java build path
  11. choose tab “libraries”
  12. click “add jars” select all files in lib folder of the current project
  13. click ok
  14. now all errors should be gone.

4. start

  1. click “run” -> “run…”
  2. double click “java application”
  3. choose main project and main class
  4. choose tab “arguments” paste into “VM arguments”: -Djava.library.path=”${project_loc}/lib/”

if ”${project_loc}/lib/” does not work, use the full path to your lib directory.
you should also download the current lwjgl package and putt all “dll, dylib and jar files in that lib folder.”

July 31st, 2007 | dev, vsys | No Comments »

how to prevent .ds_store file creation

dont you hate these ds_store files, especially on network drives where windows machines have access to ?

you can disable the creation of ds_store files for network devices.
just enter following command in your terminal:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

also have a look at the original apple document

July 30th, 2007 | mac, network, howto | No Comments »

creating a ssh tunnel using plink

if you are working in a censored/filtered network, or just feel insecure surfing pron at work, plink is a nice tool for you.
using plink you can create your own personal proxy. all you need is a ssh account somewhere on the net.

1. download plink(it is from the creators of putty)
2. write a batch file or just in a terminal:

plink -v -D 127.0.0.1:3388 -l sshlogin -pw sshpassword sshserver -P 22

(change sshlogin/sshpassword/sshserver to your needs.)
3. to use this tunnel in firefox, open it, go to preferences / connections / socks-host - enter 127.0.0.1 and port 3388
4. you are now surfing over a ssh connection.

now firefox still uses the default dns server, which means, sites could still be censored, or someone could log your dns request. to change this (for firefox): enter as url: “about:config” , find “network.proxy.socks_remote_dns”, change value to “true”.

July 11th, 2007 | network, howto | 2 Comments »

rip myspace mp3 files

on myspace one can find many nice songs. in most cases you can not download them to your harddisk, just listen to them.
the songs are beign streamed in mp3 fileformat by the flash player on the myspace site.
yesterday i wrote a little tool which downloads all songs from a myspace artists site.
how this works:

1. get firebug (which you should already have, cause its the best firefox plugin evarrrr)
2. open a myspace site with songs you like
3. open firebug (F12) / select: “Net” (second line) and “All” (upper line)
4. wait till the music is playing
5. scroll down the list
6. search for an url like:
http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=999999
7. right click on that url: “Copy Location”
8. open new window, open the copied url
9. you see an nice structured xml file, there are “durl” elements, which contain a link to .mp3 files. here you are.

all files are prepared for streaming - compressed as 96kbit 22500 Hz files, so its propably not the quality you expect.

July 10th, 2007 | howto, myspace, mp3 | 3 Comments »

contact

June 18th, 2007 | Uncategorized | No Comments »

about

this is basically just a notebook where i write down stuff for myself.

i use a modified version of fluid solutionby kaushal sheth.

June 18th, 2007 | Uncategorized | No Comments »

« Previous Entries