2nd October 2003 06:37 UTC
DM question
if I use too many variables in a DM will it fail to work?
I think I have too many variables so even when I set x=x+.1 or something like that, it wont work. Any input?
Archive: DM question
UIUC85
2nd October 2003 06:37 UTC
DM question
if I use too many variables in a DM will it fail to work?
I think I have too many variables so even when I set x=x+.1 or something like that, it wont work. Any input?
Tuggummi
2nd October 2003 06:49 UTC
With the public releases of avs the variable limit is 64 if i recall right, however with the 2.7pre releases it has been raised to 256. So when Winamp5 comes out and the final version of avs2.7 you can use 256 different named variables and in addition to that you can use global variables :D
And to your question, if you add a new variable after the 64 it will break down and your winamp will perform a "illegal operation" :rolleyes:
UIUC85
2nd October 2003 06:51 UTC
so do you have any idea why that wouldn't work then? I'm trying my hand at raytracing and I cant figure out why it wont do anything at all... even with that basic movement.
Tuggummi
2nd October 2003 09:04 UTC
Hmm...
All i can think of that you don't have rectangular coordinates checked, but that's really a n00b problem usually and i doubt you're new to avs since your talking about ray-tracing :D
I don't know what could be the problem then. Im just learning raytracing, well i got the basic "engine" figured out somehow, but it's hard to create your own special shapes etc. with it.
Maybe you should post your code here or the preset, so someone could help you. It's pretty hard to figure out exactly what your problem is right now.
UIUC85
2nd October 2003 09:37 UTC
ehh I got it working. Well except the correct texture mapping. I got it to raytrace a sphere.
Tuggummi
2nd October 2003 09:56 UTC
Heh :rolleyes:
Good for you :p
UIUC85
2nd October 2003 10:00 UTC
one last question. texture mapping. what kind of system do you guys use? cylindrical? spherical?
Tuggummi
2nd October 2003 10:07 UTC
Haven't actually tried yet any other texture mapping than what you use when you draw straight planes :rolleyes: Tho i did manage to mangle out a inside-a-cube-dm just with straight down experimenting :p
But i guess it depends a lot of what you are drawing :) I.e for a round sided tunnel i used cylindrical, which if i remember right was x=atan2(ix,iy) ;
y=iz ;
I think if you search the avs forums for raytracing you should come up with some useful links :) Also there might be something in the FAQ or in the "Tips & Tricks" thread.
UIUC85
2nd October 2003 18:26 UTC
ok so can someone help me figure out why its not texture mapping correctly. I'm using spherical coords. l=radius, ix,iy,iz=intersection point.
phi=l;
rho=acos(iy/phi);
theta=acos(iz/(phi*sin(rho)));
x=1-2*theta/(2*pi);
y=1-2*rho/(pi);
And yes I already know its not optimized. Please dont just post a bunch of optimization suggestions...
UnConeD
2nd October 2003 18:33 UTC
I think it would be faster to use an atan, because you avoid some costly divisions, and let the math lib handle things like that (faster).
frame:
irad = 1/radius;
point:
rho=acos(iy*irad);
theta=atan2(iz,ix);
It's also better to multiply by the reciprocal rather than dividing by a constant. You can memorize stuff like 1/pi because you don't need much accurace in AVS anyway. 1/pi ~ 0.318
UIUC85
2nd October 2003 19:59 UTC
even with that code I get this really distorted image on the sphere. It's unrecognizable. I found the scalar for the intersection by solving the equation of a sphere then plugged it back into the ray equations to find the intersection. Then converted to spherical coords for texture mapping. Did I do something wrong in there?
UIUC85
2nd October 2003 21:00 UTC
my image just gets VERY distorted at the top and bottom. is there some fix for this?
UIUC85
2nd October 2003 22:36 UTC
yeah so spherical mapping sucks a lot. cylindrical works so much better...
Jaak
3rd October 2003 05:27 UTC
oooh.... now i see this thread... nm
it depend on the shape what mapping you need to use, doesnt it?
UIUC85
3rd October 2003 06:21 UTC
I do have one problem with my sphere. I'm using cylindrical coords but where the ends of the texture meet I'm getting some major distortion. It seems like a rounding error to me but I dont know... Any ideas?
Jaak
3rd October 2003 07:56 UTC
you use:
x=atan2(pz,px)*(2*pi);
y=asin(py)*2/pi;
for me it doesnt give that major distortion... maybe you are just overrating powers of dm, the grid size is really small and the dm wasnt build to deal with the raytracing (no vector support etc.)
send the preset maybe I or somebody else can help
[edit]if you want to see my dm sphere then i posted it under your other thread
oh yea: USE EDIT BUTTON thankyouverymuch[/edit]
UIUC85
3rd October 2003 08:26 UTC
Did you use spherical coords on that? I dont know. I tried mapping a bitmap of the earth onto my sphere with cylindrical coords and it looks great except for the spot where the edges of the bitmap touch...
Here check it out. I know its not optimized. It's easier to understand when it isn't and it's still just a test preset.
Jaak
3rd October 2003 11:27 UTC
works indeed and the ugly edge is normal, nothing to worry about
heck, i dont understand the most of your code
do you use rotation axes or rotation matrices?
the if you use the matrices, then dont do it, the axes are much more better to read and understand, the matrices can be little faster tho'
the sphere can be dont much less code than you have, just look others code, im sure you find faster and better way your 3d skills seem to be really good
UIUC85
3rd October 2003 17:56 UTC
Any idea why there is that line that passes through the pacific ocean?
Jaak
3rd October 2003 18:30 UTC
this is just another normal hack of dm
you use grid size 500x500 then its not so noticable
UIUC85
3rd October 2003 21:50 UTC
Yeah its simplified matrix style rotation. Whats the other way like?
Jaak
4th October 2003 14:42 UTC
ok, here are two examples...
the simple rotation is one i made quick and is really simple (x and y rotations).
the second one is whanna-be-ready-for-dm-syncing-ssc but i think there is something wrong with it
[edit]
oops, fixed the rot.avs
http://acko.net/dump/jaak/rot.zip <-- this is now correct
remember to have avs2.7 pre3 for this coz i added comments its now allmost a tutorial...
...and yes, my english really s*cks
[/edit]
Deamon
4th October 2003 22:11 UTC
Nice one Jack :)
fragmer
5th October 2003 09:59 UTC
If you want to kill those edges use this for alpha:
alpha=-d*10+4.75
And set the grid size to about 40/40 - 50/50.
And the line in the Ocean... don't know about it :)
UIUC85
5th October 2003 10:37 UTC
It's just because when you get the cylindrical coords DM doesn't know enough to wrap the texture from one end to the other. Instead it takes the whole image and scrunches it into that small area. Unless someone can think of a way to fool AVS into actually wrapping across the image its just gonna have to stay there.
Fork me on GitHub