Old 16th April 2005, 08:34   #1
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
3d model files -> render/triangle

i made a little tool for converting wavefront .obj into a .gvm for use with the global variable manager (load/save) ape.

i chose .obj as its easy to read in and sketchup can export it

also there is a preset (very simple - 50/50 blended tris) showing a ~1500 poly model, its a simple model i've made its not meant to be a preset...

from the code you can see the megabuf structure used. the (currently) unused 1,2 and 3 slots are used to hold the face normal.

idiots may steal this triangle and use their own exported objs with it (its intentionally rubbish)

if you look at the code note that i shifted the model down cos i saved it 'not on the origin'.

use

objconv myobj.obj mygvm.gvm 0

0 is the offset for the data in megabuf (you can change this if you want multiple models for example)

example preset and model data attached:
Attached Files
File Type: zip objtest.zip (73.9 KB, 271 views)

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 16th April 2005, 08:37   #2
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
also here is the tool and a slightly updated global variable manager now with less crashes. but still no aperesize support on account of my lazyness and messy code. sorry tomy.

also sorry for two posts. its to dodge the filesize limit.
Attached Files
File Type: zip objconv+globmgr.zip (88.9 KB, 256 views)

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 19th April 2005, 17:39   #3
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
lots of d/ls. but no feedback. any suggestions? want more formats? find any more bugs in the gvm ape?

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 19th April 2005, 19:36   #4
eheiney
und keine Eier!
 
eheiney's Avatar
 
Join Date: Mar 2005
Location: MI, USA
Posts: 1,374
Send a message via AIM to eheiney
I downloaded it.... but I guess I didn't know what to do with it.
I thought I followed the instructions but when looking at the example, I'm presented with a blank screen.

No problems with the gvm. I love the newer option of being able to expand the code boxes. I only wish, as you said, that it was implemented with resize support.

Spiral out, my friend. You will find your way back to yourself, we all will.
I'll be waiting, and shall see you on the other side...
eheiney is offline   Reply With Quote
Old 20th April 2005, 04:07   #5
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
blank screen? thats odd

i've had all kinds of complaints that its broken in varying ways... problem is i cant fix anything without feedback

one thing that seems to fix it is to load one gvm preset then another then another... after three or four it seems to start working properly. i am still trying to fix it up a bit better... but i really cant work it out.

some presets seem to work always. specifically those that don't load on the first frame and use multiple loads seem to work okay all the time. :/

resize support will come when i work out the bugs

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 21st April 2005, 05:43   #6
MaTTFURY
Major Dude
 
MaTTFURY's Avatar
 
Join Date: Jun 2004
Location: Australia,
Posts: 1,356
Way cool, but it doesn't rotate so I can see the triangle "face"

i am not normal, no really.
MaTTFURY is offline   Reply With Quote
Old 21st April 2005, 09:34   #7
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Again Matt your lack of reading, logical deduction and common sense have contributed towards another rubbish post.

It is rotating fine... but the data hasn't loaded properly...

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 30th April 2005, 22:43   #8
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
by using 'load once' the load problems seem to have disappeared...

this version uses the triangle z-buffer and back face culling to do a reasonable non-transparent render. it has some z-fighting because of the large size of some of the tris... this can be avoided in models by splitting up larger tris.

edit: you will need to add zbclear=1 to the triangle code (per frame)
Attached Files
File Type: zip plane.zip (69.4 KB, 222 views)

-- Jheriko

'Everything around us can be represented and understood through numbers'

Last edited by jheriko; 1st May 2005 at 01:08.
jheriko is offline   Reply With Quote
Old 1st May 2005, 04:14   #9
eheiney
und keine Eier!
 
eheiney's Avatar
 
Join Date: Mar 2005
Location: MI, USA
Posts: 1,374
Send a message via AIM to eheiney
This brought a smile to my face. I wasn't expecting an actual plane.

I don't think this is what Tomy had in mind when he wrote the triangle, but who cares? It looks awesome!

I only wish I knew how to use triangle as well...

Spiral out, my friend. You will find your way back to yourself, we all will.
I'll be waiting, and shall see you on the other side...
eheiney is offline   Reply With Quote
Old 1st May 2005, 05:04   #10
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
well open up 3ds max... model a plane. export to alias/wavefront obj (you can get a plugin if its not a default cos i have that option) then steal the triangle above and compile a different gvm using objconv. :P

the idea of all this is that you dont have to be a frikkin genius to do some presets with 3d models.

about using the z-buffer with triangle tho... you need to subdivide the model to avoid z-fights like that plane gets... lots of small equilateral-ish triangles are ideal.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 2nd May 2005, 18:50   #11
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
Quote:
Originally posted by denkensiefursic
I don't think this is what Tomy had in mind when he wrote the triangle
uh, actually this was exactly what i had in mind when writing triangle.ape *g*

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 2nd May 2005, 21:55   #12
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
touché

what else is triangle ape for? making 2d triangles? pfft...


-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 3rd May 2005, 03:50   #13
eheiney
und keine Eier!
 
eheiney's Avatar
 
Join Date: Mar 2005
Location: MI, USA
Posts: 1,374
Send a message via AIM to eheiney
Touché, indeed. I raise my drink to you, as it appears I am mistaken.

Spiral out, my friend. You will find your way back to yourself, we all will.
I'll be waiting, and shall see you on the other side...
eheiney is offline   Reply With Quote
Old 6th May 2005, 15:27   #14
Synth-C
Junior Member
 
Synth-C's Avatar
 
Join Date: Aug 2003
Location: The Netherlands
Posts: 47
Jheriko, which plugin did you use?
I already tried three, and non of them worked properly.
I end up with .gvm files that only have data on every 7th 8th and 9th line or so.
Synth-C is offline   Reply With Quote
Old 9th May 2005, 06:25   #15
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
which plugin to export obj i guess?

i used sketchup with the sketup obj exporter. it is important to set it to export to just triangles though... otherwise some tris will be missing... although i'm not sure thats what you mean. could you perhaps paste a little sample of the gvm to clarify the problem?

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 9th May 2005, 13:21   #16
Synth-C
Junior Member
 
Synth-C's Avatar
 
Join Date: Aug 2003
Location: The Netherlands
Posts: 47
Sure. The .obj file I used is also included in the zip.
Attached Files
File Type: zip objconverror.zip (23.1 KB, 199 views)
Synth-C is offline   Reply With Quote
Old 9th May 2005, 19:21   #17
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
no normals are in that obj file. thats why some of the data lines are always zeros

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 9th May 2005, 23:32   #18
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
further to that... (shame i can't edit after several hours )

objconv averages vertex normals if they are given to create a face normal. so if you have vertex normals all over some curves (model packages often do this with curves) they will get 'flattened out' a bit.

Since the software triangle ape has no vertex blending there is no reason to have a normal for every vertex (makes big .gvm files too).

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 11th May 2005, 18:11   #19
Warrior of the Light
Forum King
 
Warrior of the Light's Avatar
 
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,073
I'm using autocad for rendering, then import it to 3ds max and export it as .obj. I suppose all dimensions should be smaller than 1 or does it autoresize the render to
< 1?

Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
Warrior of the Light is offline   Reply With Quote
Old 11th May 2005, 19:26   #20
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
it exports the coords in whatever scale you use in the editor. personally i just make the model then change the camera etc... to match the scale.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 10th June 2005, 15:33   #21
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
For shylent,asdfg and whomever...

notes:

it makes an ini file on first run that you can edit to set options

format of gmegabuf entries is:

number of triangles
[normal]
vertices
[gloss maps etc... in the order they are in the ini file]

I think thats right, try it out, ask me on #avs or post here if it doesnt work for some reason or you need more details
Attached Files
File Type: zip obj4avs.zip (63.2 KB, 215 views)

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 14th June 2005, 23:51   #22
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
ewww, sections...
interleaved ftw!

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 15th June 2005, 06:40   #23
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
functional difference?

if anything doing in by 'sections' rather than 'interleave' makes it easier to manage optional material properties.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 15th June 2005, 13:38   #24
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
I wrote that description in a hurry, it is interleaved, all the data for each triangle is saved seperately

[number of triangles]
// triangle 1
[normal x]
[normal y]
[normal z]
[vertex 1 x]
[vertex 1 y]
[vertex 1 z]
[vertex 2 x]
...
[vertex 3 z]
[diffuse red]
[diffuse green]
[diffuse blue]
[ambient red]
[ambient green]
...
// triangle 2
[normal x]
[normal y]
[normal z]
[vertex 1 x]
[vertex 1 y]
[vertex 1 z]
[vertex 2 x]
...
[vertex 3 z]
[diffuse red]
[diffuse green]
[diffuse blue]
[ambient red]
[ambient green]
...

etc....

incidentally I just checked the source code for Jet Wash so I could post an example of why its easiest this way... but it was saved on my desktop in a text file and I reformatted without saving it

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 15th June 2005, 22:39   #25
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
interleaved is faster

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 16th June 2005, 00:03   #26
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
The difference in speed is negligible, its more about design preference

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 16th June 2005, 07:27   #27
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
if you have 12 coords for a tri (normal xyz, vertex 1/2/3 xyz)

then interleaved is easy to code as 12*i+0, 12*i+1 etc for each component doing sections makes it annoying as you have to use sectionstart+i instead, 12*i+(1..12)+offset, storing the number of tris in offset, is normally how i do it. interleaving the triangle data and using sections (offset) to split the model into different materials.

i know using 1 triangle render is r33t but i just prefer editing the material in avs because when you can see it in the renderer moving around and being lit you can get a feel for the effects of the values you are putting in.

again... design preference rather than a speed thing, although it also keeps filesizes down a bit as the 'map' data is gone from the gvm files and in to the avs preset as a much smaller single assignment, rather than 100s.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 16th June 2005, 09:02   #28
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
Quote:
Originally posted by jheriko
i know using 1 triangle render is r33t but i just prefer editing the material in avs because when you can see it in the renderer moving around and being lit you can get a feel for the effects of the values you are putting in.
I cant edit those presets in AVS because I can't use the new AVSTrans (the old one causes infinate load times blah blah Im sure you know...) so that particular benefit is achedemic.

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 16th June 2005, 11:59   #29
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
let's say we have 8 properties for each vertex
code:

interleaved:
index=pn*8+3; // can be optimized by counting with pn=pn+8;

sections:
index=pn+3*n; // can be optimized by having 7 variables in 'Frame' (offset1=1*n; offset2=2*n; offset3=3*n; ...)


If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 16th June 2005, 12:29   #30
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
So I put the egg in my mouth... THEN I suck... oh ok.

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 16th June 2005, 14:28   #31
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
one advantage is that you dont need to set 7 variables to make it effective

the bigger advantage is that you can dynamically alter the triangle count

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump