Author Topic: 3D Twister - Sinus Methods  (Read 19278 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #20 on: September 15, 2008 »
Yeah dude I get what the current method of twisting does; and thanks for clarifying. I was wonderning if there was any different calcs to use, etc.

I'll do up an exe and some piccies; i've got to nip out for a bit, and will do it when I get back.

Cheers, and all the very best,
Clyde
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #21 on: September 15, 2008 »
Here's an exe and bb source of the twister. if you look closely & carefully, when the twist is happening on the sides there is a ripple / bump type effect.

Also still very interested in different sinus methods!

Will post some rough picture examples later ron.

Big thanks,
Clyde
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #22 on: September 15, 2008 »
Quote
when the twist is happening on the sides there is a ripple / bump type effect.
that's mathematically plausible:
When rotating the segments against each other, the texture is no longer parallel to the polygon which makes linear interpolation fail.

To make it less obvious you can only use more segments (thus making the interpolation-gaps smaller).
Note that most of your object currently extends out of the bottom screen (currently visible in y is ~60..75), so you don't need more segments but just a better arrangement.
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: 3D Twister - Sinus Methods
« Reply #23 on: September 15, 2008 »
@Clyde dude:
Looks good now. Good work.

@hellfire:
Awesome help and cool example source !
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17427
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: 3D Twister - Sinus Methods
« Reply #24 on: September 15, 2008 »
That looks pretty cool indeed :)

I am a sucker for twisters.. I coded one while I was at Sundown, I'll have to grab it off the laptop and post it (It's not 3D like yous though).. It's not as good as what you have here but it moves in a strangely crazy way.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #25 on: September 16, 2008 »
I forgot to mention yesterday:
In the way you now assign your texture-coordinates you get wrong texture-scaling (and inverse u-direction) on one side of your object because the last edge connects vertices 0 and 3 (here delta-u is 0.75 while the other faces have 0.25)
To fix this you would need a fifth vertex with the same position as vertex0 and a u-coordinate of 1.0.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #26 on: September 16, 2008 »
Ok cheers for that, how would I go about using this 5th Element?
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #27 on: September 16, 2008 »
you add an additional vertex:
Code: [Select]
vc(a)=AddVertex(surface,  x#,y#,z#, 1.0, v#) : a=a+1
And connect the last edge to this new vertex instead of wrapping back to vertex 0:
Code: [Select]
For i1= 0 To 3
i2= i1+1
For j=0 To segs-2
    v0=j*5+i1
            v1=j*5+i2
            v2=(j+1)*5+i1
            v3=(j+1)*5+i2

            AddTriangle( surface, vc(V0), vc(V2), vc(V1) )
    AddTriangle( surface, vc(V1), vc(V2), vc(V3) )

Next
Next

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #28 on: September 16, 2008 »
Cheers dude.

Thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #29 on: September 20, 2008 »
Im now looking for different ways / new approaches of adding sin and cos ( Sinus Methods ), for more variety to the effect. as per the original topic title.
 
If anyone has suggestions and ways, I'd love to hear about them. :D
And they can be in Blitz Degrees style, or Radians. My brain cell is acting up.

Many Huge Thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #30 on: September 21, 2008 »
You're gonna have to write some of this demo yourself eventually ;)
Quote
Quote
angle#= Sin( (v#*12.0 - Time#*0.9) * RAD2DEG )*2.5
Bigger values bend "further"

Quote
angle#= Sin( (v#*12.0 - Time#*0.9) * RAD2DEG )*2.5
..."faster"

Quote
angle#= Sin( (v#*12.0 - Time#*0.9) * RAD2DEG )*2.5
..."tighter"

My first port of call would be to make these constants in to variables.  Then animate them using sin.
So, eg.
Code: [Select]
angle#= Sin( (v#*12.0 - Time#*0.9) * RAD2DEG )*rotation_speed
rotation_speed = sin(frame_counter*some_scale_factor)
or
rotation_speed = y * some_scale_factor
or
...

Jim

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #31 on: September 21, 2008 »
Thanks dude much appreciated, im in the process of re-exploring and experimenting with Blitz3D.
However I was after different approaches to the sinus motion.

Cheers,
Clyde.
« Last Edit: September 22, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #32 on: September 23, 2008 »
You are now animating the rotation angle only.
As pointed out earlier, you can also animate the center-position, radius or center-of-rotation of each segment.
The "sin" function is only used to "make things go forth and back", but you can use any function imaginable.
You're usually getting good (means: still smooth but less predictable) results when adding multiple sine-waves with different amplitudes and frequencies to form the resulting "value".
You can also load a texture (which is basically a table of a 2d-function) and pick your values from there instead of doing a simple "sin"...
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #33 on: September 26, 2008 »
Ok cool dude and thanks & I will experiment some more.

I have another query / problem with texturing the object, I have designed a texture of 64*256, and it wont properly map to it, meaning each side / face of the cuboid isnt quite right. I think its to do with the U and V, but am not entirely sure how I would solve this problem, and i'd love a hand in working it out please dude?

Cheers and hugest of thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #34 on: September 26, 2008 »
Quote
each side / face of the cuboid isnt quite right
Can you post an example?
Are you now using a 5th vertex to compensate the texture-seam?
Do you using any texture-tiling?
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #35 on: September 26, 2008 »
I am using the 5th vertext to compensate the texture-seam, and Im not using any texture tiling; as I dont wont to use any inbuilt texture scaling commands, id like the model to be able to map it properly.

Below is an example texture image and zip with exe and source:
« Last Edit: September 26, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #36 on: September 26, 2008 »
I don't have Blitz installed anymore, so just some theory again.
This is the way you are now assigning your texture coordinates:
Code: [Select]
vc(a)=AddVertex(surface,  x#,y#, z#, 0.0 , v#) : a=a+1
vc(a)=AddVertex(surface, -z#,y#, x#, 0.25, v#) : a=a+1
vc(a)=AddVertex(surface, -x#,y#,-z#, 0.5 , v#) : a=a+1
vc(a)=AddVertex(surface,  z#,y#,-x#, 0.75, v#) : a=a+1
vc(a)=AddVertex(surface,  x#,y#,z#,  1.0, v#) : a=a+1

So your are wrapping the width of the texture (u= 0..1) once around the whole object.
But you probably want to map the texture once on each side?
Just multiply your texture-coordinate by 4 then.

Basically the same applies to the v-coordinate. Because the cuboid is much higher than the screen, there are only a few segments visible, so you might want to scale it accordingly to avoid texture-stretching.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #37 on: September 26, 2008 »
Ok dude, thanks mate.

Not quite sure on the scaling part to avoid texture stretching?

Cheers,
Clyde.
« Last Edit: September 26, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: 3D Twister - Sinus Methods
« Reply #38 on: September 26, 2008 »
ok, ive mutiplied the texture co-ords by 4; still have a problem with it on it's v.

Any solutions?

I have tried dividing the v's by the height ( 100 ) but I dont think thats the solution.

Cheers and many thanks,
Clyde.
« Last Edit: September 26, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 3D Twister - Sinus Methods
« Reply #39 on: September 26, 2008 »
Clyde, using smaller (dividing the existing) texture-coordinates means that a smaller area of the texture is stretched across the polygon. What you want is the opposite.
Challenge Trophies Won: