Winamp & SHOUTcast Forums > AVS How to create cubic room DM

 17th February 2012, 13:35 #1 patipano Junior Member   Join Date: Jan 2012 Posts: 20 How to create cubic room DM Please show me or explain the code of box-like(room) dynamic movement. I cant understand such a code Example Presets: Tuggummi - Let me out! UnConeD - Cubic Flower
 19th February 2012, 15:33 #2 patipano Junior Member   Join Date: Jan 2012 Posts: 20 Example Code (UnConeD - Watercolorcube): ```code: Init: t=rand(100);rx=1.57;ry=1.57;rx=0;ry=0;pt=0;bt=0 Frame: sd=sd*.9+getspec(0,.1,0)*.1; sd2=sd2*.9+getspec(0,.05,0)*.1; t=t+0.19+sd*.75;pt=pt+.25+sd2*.5; ox=sin(pt*.1231);oy=sin(pt*.1);oz=cos(pt*.0913); ol=-bt*.5+3/sqrt(sqr(ox)+sqr(oy)+sqr(oz)); ox=ox*ol;oy=oy*ol;oz=oz*ol; rxo=sin(t*.0373)*cos(t*0.0563)*sin(cos(t*.0631))*.5; ryo=sin(t*.0511)*cos(t*0.071)*sin(cos(t*.0415))*.5; ry=-atan2(ox,oz)+ryo; rx=-atan2(oy,sqrt(sqr(ox)+sqr(oz)))+rxo; rz=sin(t*.053)*cos(t*.117)*sin(cos(t*.0651)); cx=cos(rx);sx=sin(rx);cy=cos(ry);sy=sin(ry);cz=cos(rz);sz=sin(rz); bt=bt*.9;af=h/w Beat: pt=pt+55*max(0,getspec(0,.1,0)*3-1.5); bt=1 Pixel: y=y*af; dx1=x*cz-y*sz; dy1=x*sz+y*cz; dy2=dy1*cx-1.2*sx; dz2=dy1*sx+1.2*cx; dx3=dx1*cy-dz2*sy; dz3=dx1*sy+dz2*cy; k1=((oz-sign(dz3))/dz3); k1=if(below(k1,0),-1000,k1); k2=((oy-sign(dy2))/dy2); k2=if(below(k2,0),-1000,k2); k3=((ox-sign(dx3))/dx3); k3=if(below(k3,0),-1000,k3); k=max(max(k1,k2),k3); ix=-ox+dx3*k;iy=-oy+dy2*k;iz=-oz+dz3*k; alpha=bnot(equal(k,-100)); x=if(equal(k,k3),iy,ix)*.9; y=if(equal(k,k1),iy,iz)*.9; d=max(abs(x),abs(y)); alpha=if(bor(above(k,10),below(k,0)),0,1.8-sqr(d+.5)+.2); ``` This is a box-like(or Cube Surface) code
 15th April 2012, 22:30 #3 jheriko Forum King     Join Date: Aug 2002 Location: a twist in the fabric of space Posts: 2,150 this code performs a raytrace - with some hacks - to achieve its effect. the idea is to get the equation of a line, from a direction and start position, and intersect it with the equations of planes describing the cube to find the texture coordinates we want on the cube's surface. ox,oy,oz are a camera position y=y*af is aspect ratio correction the big block of code involving sx, cx, sy... are rotations the k = lines are solving the raytrace and picking the correct solution x and y are then set based on the results. these are texture coordinates. alpha provides the fading to hide ugly edges. if you try and recreate this approach from scratch without copying code you should get a good understanding of the technique and be able to apply it to arbitrary situations... AVS code like this is not easy to pick apart or follow, the coding style we all used to use, the lack of comments and the obscurity of the problems all pile up to make it very difficult. -- Jheriko 'Everything around us can be represented and understood through numbers'
 18th July 2012, 06:24 #4 patipano Junior Member   Join Date: Jan 2012 Posts: 20 Could you show me a general equation of k? Does it (ray tracing) involving with calculus? (Partial Derivative, Integral, Tangent plane, etc)
 Winamp & SHOUTcast Forums > AVS How to create cubic room DM

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Tech Support Greatest Hits Winamp     Winamp Technical Support     Winamp Discussion     Winamp Wishlist     Winamp Bug Reports     Winamp for Android     Winamp for Mac Sync     Winamp Site Design     Winamp Online Services SHOUTcast     SHOUTcast Technical Support     SHOUTcast Discussions     SHOUTcast Streaming Service & Monetization     SHOUTcast Site Design International Connection     International Connection     Русскоязычный форум (Russian)     Français: de l'aide pour les francophones (French)     Winamp Deutsch (German) Community Center     General Discussions     Breaking News     Music O'Rama     Games Center     Movies and Television     The Bitchlist Skinning and Design     Skinning Tips and Tricks     Classic Skins     Modern Skins     Arts and Design Developer Center     Winamp Development     NSIS Discussion         NSIS Translations Visualizations     AVS         AVS Presets         AVS Wishlist         AVS Troubleshooting     MilkDrop         MilkDrop Presets         MilkDrop Development         MilkDrop Feature Requests         MilkDrop Troubleshooting Forum

 -- Deutsch -- English (US) -- Polish -- Russian Winamp.com - Help - Archive - Top