Recent Posts

Pages: [1] 2 3 4 5 6 7 8 ... 10
1
Freebasic / Re: little 3d cube with bumpmapping.
« Last post by ninogenio on Today at 02:59 AM »
sorry i realise that was very wrong  :).

im now creating a tangent binormal and normal for each vertex like this.
Code: [Select]
Sub ComputeTangentMatrix( Tangent As Vector4d, BiNorm As Vector4d, TangNorm As Vector4d, Vec1 As Vector4d, Vec2 As Vector4d, Vec3 As Vector4d _
    , Uv1 As Vector2d, Uv2 As Vector2d, Uv3 As Vector2d )
           
    Dim As Double v1x, v1y, v1z, v2x, v2y, v2z, u1x, u1y, u2x, u2y, Recip
 
    v1x = Vec2.x - Vec1.x
    v1y = Vec2.y - Vec1.y
    v1z = Vec2.z - Vec1.z
 
    v2x = Vec3.x - Vec1.x
    v2y = Vec3.y - Vec1.y
    v2z = Vec3.z - Vec1.z
 
    u1x = Uv2.x - Uv1.x
    u1y = Uv2.y - Uv1.y
 
    u2x = Uv3.x - Uv1.x
    u2y = Uv3.y - Uv1.y
 
    Recip = 1.0/(u1x * u2y - u2x * u1y)
 
    Tangent.X = (v1x * u2y - v2x * u1y) * Recip
    Tangent.Y = (v1y * u2y - v2y * u1y) * Recip
    Tangent.Z = (v1z * u2y - v2z * u1y) * Recip
 
    Binorm.X = (-v1x * u2x + v2x * u1x) * Recip
    Binorm.Y = (-v1y * u2x + v2y * u1x) * Recip
    Binorm.z = (-v1z * u2x + v2z * u1x) * Recip
 
    TangNorm.X = BiNorm.Y * tangent.Z - BiNorm.z * Tangent.Y
    TangNorm.Y = BiNorm.Z * tangent.X - BiNorm.x * Tangent.Z
    TangNorm.Z = BiNorm.X * tangent.Y - BiNorm.y * Tangent.X

    NormilizeVec( @Tangent )
    NormilizeVec( @binorm )
    NormilizeVec( @TangNorm )
   
End Sub

this just feeds the T B N Vectors back to the 3dobject struct and they sit alongside the vertex's. now that i have 1 T B N vector per vertex im not 100% sure how too use all three too rotate the normals. Maybe Feed them into the rasterizer and interpolate?.

im trying the lighting like so too
Code: [Select]
Sub SetUvLight1( Vertex As Vector4d, Light As Vector4d, T As Vector4d, B As Vector4d, N As Vector4d  )

    Ind0.Lx = (Light.X - Vertex.X)
    Ind0.Ly = (Light.Y - Vertex.Y)
    Ind0.Lz = (Light.Z - Vertex.Z)
   
    NormilizeVec( @Ind0 )
    'tx.bx.nx column major
    'ty.by.ny
    'tz.bz.nz
    'inv = row major
    'tx.ty.tz
    'bx.by.bz
    'nx.ny.nz
    'tried inverting the ind vectors also too see if it would work
    Ind0.Lx = (T.X*Ind0.Lx + T.Y*Ind0.Lx + T.Z*Ind0.Lx)
    Ind0.Ly = (B.X*Ind0.Ly + B.Y*Ind0.Ly + B.Z*Ind0.Ly)
    Ind0.Lz = (N.X*Ind0.Lz + N.Y*Ind0.Lz + N.Z*Ind0.Lz)

End Sub

each SetUvLight now gets its own T B N Vectors that correspond too the vertex. for some reason though the light is always offset too the left of the texture its like im missing another step. i tried a few things like translating and rotating the direction vector but with no luck. i think im definitly missing something but cant think what.

the reason im trying too do it on this way having a T B N Vector for each vertex is simply because all the examples out there are in glsl so im having too try and follow them but im not so good at shaders so its a bit sketchy for me.
2
General chat / Re: Fun with l.e.d.s
« Last post by Kirl on Today at 01:24 AM »
Good luck Raizor! :)

Nino, meaby a 3d printer would be something to look into someday. I know there's at least one open source project. Once you got it working, coding for it should be easy. Printing out a 3d plasma and a bunch of super shapes is on the top of my to do list once I get my hands on one. :kewl:

I bet once 3d printing takes off it will be an even bigger revolution then the internet was. 
3
General chat / Re: Fun with l.e.d.s
« Last post by Raizor on Yesterday at 10:16 PM »
Wonderful ninogenio, thanks very much :)
4
General chat / Re: Fun with l.e.d.s
« Last post by ninogenio on Yesterday at 10:03 PM »
no probs mate heres a little list of things you might like too grab if your interested in starting this project.

http://www.ladyada.net/make/mshield/
http://www.ebay.co.uk/itm/2390-Point-Solderless-Breadboard-Protobloc-4-bindings-/130905556654?pt=LH_DefaultDomain_3&hash=item1e7a9446ae
http://www.ebay.co.uk/itm/Electronic-Project-Beginners-Starter-Kit-quality-components-pack-with-breadboard-/110887787457?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19d16d5bc1
http://www.ebay.co.uk/itm/75-Jumper-Cables-for-Solderless-Breadboard-Arduino-/171028359908?pt=LH_DefaultDomain_3&hash=item27d215aae4
http://www.ebay.co.uk/itm/140-Jumper-wires-for-Solderless-Breadboard-Arduino-/171043619319?pt=LH_DefaultDomain_3&hash=item27d2fe81f7
http://www.ebay.co.uk/itm/Sintron-Arduino-Uno-R3-USB-cable-for-starter-in-UK-/160996929563?pt=UK_Computing_Other_Computing_Networking&hash=item257c2a301b

that should be more than enought too get almost any basic project off the ground.

i would imagine you will be wanting too have the camera movable in three directions rotation Pitch and height. if this is the case you will need three motors and some sort of arm that sits on a small turn table that gets rotated with motor1, then motor2 will go somewhere in the middle of the arm and control the cameras height and the 3rd motor will control the pitch of the camera.

as for the arm i would just build it out of a mechano set it should be simple.

however before worrying about the arm and its ergonomics i would do the circuit on a bench first. this is where the motor shield comes in it makes driving motors really easy. you can drive up too 4 2 way (forward and backward) motors or 2 forward backward stepper motors( variable speed ).

its a simple case of plug the motor shield into the arduino, wire the motors too the motor shield, plug the whole thing into the pc. then yous the motor shield programing library too driving it all, these library's are very simple too use they are usually really primative and self explanitory. and that's 90% of the project done right there :)

theres loads of code examples floating around for the motor shield but that will be the super easy part for someone like your self.

its really one of those things that until you get the basic kit set up it does seem a bit scary but after a few projects you realize, its really not any harder than the stuff we do here.
5
General chat / Re: Fun with l.e.d.s
« Last post by Raizor on Yesterday at 02:50 PM »
Thanks ninogenio for the info :)

ill dig out some links with the parts you will need if you like.

That would be lovely, thanks :)
6
General chat / Re: Fun with l.e.d.s
« Last post by ninogenio on Yesterday at 02:33 PM »
hey raizor no problem mate.

the arduino is probably the best documented microcontroller out there with tons of libs and examples so defo the best too use as a jump start. i went a different way i started here http://www.parallax.com/ but in hind sight that maybe wasnt the right way although ive had tons of fun with the parallax too i built the game development extension board now it plugs into my tv and using a nunchuck controller i can play games with it.

yes definitely grab as many breadboards as you can you will soon need them :).

also grab things like jumper cables, leds, resistors, capacitors, a few voltage regulators, these are all dirt cheep off fleabay..
also keep a look out for old bust electronic toys or items about the house, you can pull loads of stuff off them and use them with your breadboards..

once you have a nice little collection of parts making the actual stuff is easy..

the motorized webcam should be perfectly possible you will need a little motor controller for the arduino again cheep of ebay but makes driving motors in forward or reverse easy. for assembly you will probably need a glue gun and some sticks.

ill dig out some links with the parts you will need if you like.

7
Freebasic / Re: little 3d cube with bumpmapping.
« Last post by ninogenio on Yesterday at 02:21 PM »
hey hellfire been bashing away at this all morning..

i think im close. theres still a few things off though like im having too invert x and y  matrix parts too get it too work like so.

Code: [Select]
No.X = (Temp.X*TangentMatrix(1).Y + Temp.Y*TangentMatrix(1).X + Temp.Z*TangentMatrix(1).Z)*1024
No.Y = (Temp.X*TangentMatrix(2).Y + Temp.Y*TangentMatrix(2).X + Temp.Z*TangentMatrix(2).Z)*1024
No.Z = (Temp.X*TangentMatrix(3).Y + Temp.Y*TangentMatrix(3).X + Temp.Z*TangentMatrix(3).Z)*1024

but it does rotate the normals in the correct direction.. my tangent matrix function looks like so atm.
Code: [Select]
Sub ComputeTangentMatrix( Vec1 As Vector4d, Vec2 As Vector4d, Vec3 As Vector4d, Uv1 As Vector2d, Uv2 As Vector2d, Uv3 As Vector2d _
    , Norm1 As Vector4d, Norm2 As Vector4d, Norm3 As Vector4d )
           
            Dim As Vector4d Tangent
            Dim As Vector4d Uv
           
            Dim As Double X1 = Vec2.X - Vec1.X
            Dim As Double X2 = Vec3.x - Vec1.X
            Dim As Double Y1 = Vec2.y - Vec1.Y
            Dim As Double Y2 = Vec3.y - Vec1.Y
            Dim As Double Z1 = Vec2.z - Vec1.Z
            Dim As Double Z2 = Vec3.z - Vec1.Z
       
            Dim As Double U1 = Uv2.x - Uv1.x
            Dim As Double U2 = Uv3.x - Uv1.x
            Dim As Double V1 = Uv2.y - Uv1.y
            Dim As Double V2 = Uv3.y - Uv1.y
           
            Uv.X = (V2 * X1 - V1 * X2) / (U1 * V2 - U2 * V1)
            Uv.Y = (V2 * Y1 - V1 * Y2) / (U1 * V2 - U2 * V1)
            Uv.Z = (V2 * Z1 - V1 * Z2) / (U1 * V2 - U2 * V1)
           
            Tangent.X = (U1 * X2 - U2 * X1) / (U1 * V2 - U2 * V1)
            Tangent.Y = (U1 * Y2 - U2 * Y1) / (U1 * V2 - U2 * V1)
            Tangent.Z = (U1 * Z2 - U2 * Z1) / (U1 * V2 - U2 * V1)

            TangentMatrix(3).X = Uv.X
            TangentMatrix(2).X = Tangent.X
            TangentMatrix(1).X = ( Tangent.X+Norm1.X * Tangent.X+Norm2.X * Tangent.X+Norm3.X )
           
            TangentMatrix(3).Y = Uv.Y
            TangentMatrix(2).Y = Tangent.Y
            TangentMatrix(1).Y = ( Tangent.Y+Norm1.Y * Tangent.Y+Norm2.Y * Tangent.Y+Norm3.Y )
           
            TangentMatrix(3).Z = Uv.Z
            TangentMatrix(2).Z = Tangent.Z
            TangentMatrix(1).Z = ( Tangent.Z+Norm1.Z * Tangent.Z+Norm2.Z * Tangent.Z+Norm3.Z )
            NormilizeVec( @TangentMatrix(1) )
            NormilizeVec( @TangentMatrix(2) )
            NormilizeVec( @TangentMatrix(3) )
           
End Sub

ive also added lots of other stuff in there like the normalization of the cube etc. im not yet converting the light but i am interpolating it. i figure i better get the basic matrix stuff nailed first and take it a step at a time

8
General chat / Re: Fun with l.e.d.s
« Last post by Raizor on Yesterday at 11:53 AM »
I've always wanted to try my hand at electronics, and I have collected a few books over the years. To be honest, it still kinda scares me a bit, I'm not sure why. Would you recommend an Arduino as a first step Ninogenio? I've been thinking about building some sort of remote controlled webcam that sits on a motorized platform that I can control remotely. Not sure if that's a bit too ambitious for a first project though :)

Anyway, this is really great and has got me needing to actually read some of those books properly now. Any other suggestions for basic things I should pick up for getting started would be great (breadboards etc).

And thanks for the greet :)
9
C / C++ /C# / Re: [C++][OpenGL] Sine Scroller
« Last post by lucastar on Yesterday at 10:37 AM »
Thanks ninogenio! Now i'm trying to do the char stuff...
If I make it, i will upload results + code.
10
C / C++ /C# / Re: [C++][OpenGL] Sine Scroller
« Last post by ninogenio on Yesterday at 10:20 AM »
hey lucastar just had a proper go through your thread,

looks cool mate, and runs perfect on my dell laptop widows 7 geforce 650m core i7. im going too say you have the effect pretty much nailed as it looks as good as any old school pixel pushed sin scrolling stuff ( without the chars being cycled ). ive seen, k+
Pages: [1] 2 3 4 5 6 7 8 ... 10