[x3d-public] Beginner questions part 2 :)

Joseph D Williams joedwil at earthlink.net
Thu Jan 17 11:45:11 PST 2019


➢ You can use these dimensions create a piece of 6D geometry in x3d.

Should have said to create 3D geometry. 

For example, this is a version of a box made op of 6 sides. 
There are a lot of ones in this example, some are x y z locations of the corners of sides of this unit box and some relate to how the points are connected together. 

# Box 
DEF boxfront Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxfront.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [ 0 1 2 3 -1 ]
    coord Coordinate {
      point [ -1 -1 1, 1 -1 1, 1 1 1, -1 1 1 ]
    }
    texCoordIndex [ 0 1 2 3 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}
DEF boxright Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxright.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [ 0 1 2 3 -1 ]
    coord Coordinate {
      point [ 1 -1 1, 1 -1 -1, 1 1 -1, 1 1 1 ]
    }
    texCoordIndex [ 0 1 2 3 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}
DEF boxrear Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxrear.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [ 0 1 2 3 -1 ]
    coord Coordinate {
      point [ 1 -1 -1, -1 -1 -1, -1 1 -1, 1 1 -1 ]
    }
    texCoordIndex [ 0 1 2 3 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}
DEF boxleft Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxleft.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [ 0 1 2 3 -1  ]
    coord Coordinate {
      point [ -1 -1 1, -1 1 1, -1 1 -1, -1 -1 -1 ]
    }
    texCoordIndex [ 1 2 3 0 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}
DEF boxtop Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxtop.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [ 0 1 2 3 -1 ]
    coord Coordinate {
      point [ -1 1 1, 1 1 1, 1 1 -1, -1 1 -1 ]
    }
    texCoordIndex [ 0 1 2 3 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}
DEF boxbottom Shape {
  appearance Appearance {
    material Material { }
    texture ImageTexture {
      url [ "textures/boxbottom.jpg" ]
    }
  }
  geometry IndexedFaceSet {
    coordIndex [  0 1 2 3 -1  ]
    coord Coordinate {
      point [ -1 -1 -1, 1 -1 -1, 1 -1 1, -1 -1 1 ]
    }
    texCoordIndex [ 0 1 2 3 -1 ]
    texCoord TextureCoordinate {
      point [ 0 0 1 0 1 1 0 1 ]
    }
  }
}

Of course there are other ways to do it, maybe using fewer points, but if you figure this out then you will learn the basics of how to draw a shape. If you use the code to create an x3d scene to display the box, then you can do experiments with colors and textures, and even how to draw a box several different ways than using this very simple self-documenting form of the IndexedFaceSet. Really, there are only a couple of rules, like the points are indexed 0 to whatever, the index -1 completes the connection by creating an edge between the previous listed point and first listed point, and regardless of how you define the polygon, the visualization will be composed of triangles. 

But IF you wish to work in a system that does not really intend to show you the user code, don’t worry, the tech is well-enough developed so you may never have to look under the covers of the graphical user interface.  
  
Also, please have a look at stuff like this for real applications using interactive 3D scenes. 

https://learnbrite.com/vr-enterprise-elearning/?utm_content=blog_post&utm_campaign=Digital_Raspberry_Marketing&utm_source=LinkedIn&utm_medium=danny_personal&utm_term=13_Reasons_Why_VR_Enterprise_eLearning_ISN%E2%80%99T_What_You_Need_Next

Good Luck, 
Joe




From: Joseph D Williams
Sent: Thursday, January 17, 2019 10:01 AM
To: iam here; x3d-public at web3d.org
Subject: Re: [x3d-public] Beginner questions part 2 :)

➢ ....so, I just wanna get a feel for what X3D code looks like,

OK, get out a pencil and paper. Start with a top view of your room and dimension it in meters.
Do the same with front and back and side as necessary for you to place an x y z dimension label at each corner or other point of interest. You can use these dimensions create a piece of 6D geometry in x3d. 
Now get a text editor and the X3d standard and figure out how to use those dimensions to create a Shape.
That will be some sort of a start, but if you get a browser like instant or x3dom, run some examples and then read the code you will get the ideas. 

Thanks and Best, 
Joe 

From: iam here
Sent: Wednesday, January 16, 2019 10:39 AM
To: x3d-public at web3d.org
Subject: [x3d-public] Beginner questions part 2 :)

Hi,
....so, I just wanna get a feel for what X3D code looks like, I was just wondering if anybody here could help me out with these 2?:
1) A simple room, 4 walls, that you can move around inside of, with the cursor keys. Looking-up-and-down, for the moment, NOT needed (I'll tackle that later :) ). I'm curious as to how the walls, ie. the polygons, will be defined for example....
2) A model of a man (made in say, Blender), taking a step. I'm curious as to how the Blender file will be made available to the browser, ie. made programmable by   Javascript; and then, how the JS itself *makes* the man take a step.
If this is too hard/undecipherable for a total beginner, then Tell Me! :)

Thanks everyone, I really appreciate you guys' help :)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190117/a3523fcb/attachment-0001.html>


More information about the x3d-public mailing list