3d Programming books

edited April 2016 in General

I'm looking for books on 3d programming, any suggestions ? I found the one by Ira Greenberg to be easier to understand with less math/equations. Something similar for 3D stuff would be nice; wanted to start with a pipe that goes randomly over the screen.

Tagged:

Answers

  • I did the pipe thing...

    essentially 3D is the same as 2D, just think of an Aquarium instead of a screen...

    x is going to the right

    y is the height above the ground

    z is the depth

    PVector is your friend and pushMatrix and popMatrix are his buddies

    Some commands come with 3D: sphere, cube of course but also PShape and line() (with 6 parameters instead of 4) and text() (4 params instead of 3)

    There is nice tutorial on P3D

    Did you look at the books section, eg nature of code is free online

  • could you post the code if that is handy ? I have been looking at toroid example in book by ira greenberg; but think he's skipped some explanation.

  • Answer ✓

    The first link shows a collection with a section for beginners

    The 2nd is the pipe sketch

  • thanks will take a look at that. I'm math noob, a detailed explanation of drawing or rotating around axes(with example) would be useful.

  • Just read the tutorials on P3D and trigonometry and read the Sketches and play with them

    Rotation is measured in radians not degrees

    in 3D you can rotate around x axiy, around y and around z axis

  • edited April 2016

    this shows you different rotations

    2 boxes (gray and red) rotate around their center, one (blue) rotates around another box (red)

    you can see that the translations and rotations are isolated from each other. This is achieved by pushMatrix and popMatrix around one block.

    More you'll learn from the tutorial on P3D

    https://www.processing.org/tutorials/

    Best, Chrisir ;-)

    float a;       // Angle of rotation 1
    float a2;      // Angle of rotation 2
    
    void setup() 
    { 
      size(940, 760, OPENGL);
    } 
    
    void draw() 
    {     
      background(0, 0, 26);
      lights(); 
    
      // big gray box in the center 
      pushMatrix();
      translate(width/2, height/2);
      fill(188);
      rotateY(a);
      box(200);
      popMatrix();
    
      // red box
      pushMatrix();
      translate(width/2, height/2);
      translate(200, 230);
      fill(255, 2, 2);
      rotateY(a2);
      box(20);
      popMatrix();
    
      // blue box 
      pushMatrix();
      translate(width/2, height/2);
      translate(200, 230);
      fill(2, 2, 255);
      rotateY(a2);
      translate(123, 0); 
      box(20);
      popMatrix();
    
      // increase angles 
      a += 0.01;
      a2 += 0.053;
    } 
    
Sign In or Register to comment.