Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: Warp3D tutorials  (Read 1303 times)

0 Members and 1 Guest are viewing this topic.

Offline Minuous

Warp3D tutorials
« on: April 12, 2012, 05:55:39 PM »
Hello, I am trying to use Warp3D to enable a flat texture-mapped square/rectangle to be viewed at different angles.

How can I create non-triangular objects? I want to create a square/rectangle. This can be done by creating two triangles adjacent to each other, but Warp3D seems to be designed to wrap rectangular textures onto triangles for some reason, which isn't very useful. How do I tell the system to wrap the texture around both triangles (ie. to treat them as a single object)?

How do I move the camera/viewpoint (as can be done in eg. AMOS 3D), there doesn't seem to be any way of doing this? Must I instead move the triangles?

Is there any example code or tutorials available? I had a look on Aminet, there is almost nothing.
 

Offline Karlos

Re: Warp3D tutorials
« Reply #1 on: April 12, 2012, 07:02:42 PM »
Quote from: Minuous;688232
Hello, I am trying to use Warp3D to enable a flat texture-mapped square/rectangle to be viewed at different angles.

You need to use W3D_DrawTriFan(), W3D_DrawTriSttrip() or better still, W3D_DrawArray() with their corresponding data structures. I suggest the latter since you have much more control over how the vertex data is organised.

Quote
How can I create non-triangular objects? I want to create a square/rectangle. This can be done by creating two triangles adjacent to each other, but Warp3D seems to be designed to wrap rectangular textures onto triangles for some reason, which isn't very useful. How do I tell the system to wrap the texture around both triangles (ie. to treat them as a single object)?

You create a triangle strip or a triangle fan. In a strip, alternate triangles share two points along an edge. In a fan, all triangles share one common vertex and adjacent triangles also share an edge. The simplest to illustrate is the strip. A rectangle is simply a 2 triangle strip, something like this:

Code: [Select]
V[0]--V[1]
|      /|
|     / |
|    /  |
|   /   |
|  /    |
V[2]--V[3]

Using one of the strip drawing methods, the same texture is applied to all polygons in the strip. If you use the old single triangle routines, you have to either enable global texture environment or specify the texture in each polygon separately.

Quote
How do I move the camera/viewpoint (as can be done in eg. AMOS 3D), there doesn't seem to be any way of doing this? Must I instead move the triangles?

Warp3D is a rasterizer only. That means that it draws primitives in screen space. Stictly, the axes are defined as X=left to right in pixels, Y top to botton in pixels, Z is plane of the screen into the distance. The valid range for Z is 0.0 - 1.0.

You need to calculate your vertices in screen space directly or write your own transformation pipeline.
« Last Edit: April 12, 2012, 07:07:19 PM by Karlos »
int p; // A
 

Offline woof

Re: Warp3D tutorials
« Reply #2 on: April 13, 2012, 09:37:57 AM »
Hello
have a look to
http://aminet.net/dev/src/StarshipW3D.lha

replace  StarShipW3D.h with a simple textured square object like that

/* This file contain all the datas for the 3D-object */
/* All points    : a point    is defined as 5 coordinates U V X Y Z */
/* All triangles : a triangle is defined as 3 indices to the points */

#define TEXNAME "StarShip_256X256X24.RAW"
#define TEXSIZE 256

#define pointsCount 4
#define trianglesCount 2
float points[pointsCount*5] = {
   0.00 0.00 0.0 1.0 0.0    
   0.99 0.00 1.0 0.0 0.0
   0.99 0.99 1.0 1.0 0.0
   0.00 0.99 0.0 1.0 0.0
        };
ULONG indices[trianglesCount*3] = {
        0,1,2,
        0,2,3
};

Alain
 

Offline AJCopland

Re: Warp3D tutorials
« Reply #3 on: April 13, 2012, 01:50:22 PM »
It sounds like you could do with a source of some basic information about Perspective, Model and World transformations. Or the OpenGL transformation pipeline. (try Google)

Some of the NeHe tutorials come in for a lot of flack for being out of date and a lot of them definitely NOT the best way of doing things. However, as a resource to learn from a lot of people find them very useful. The link to the lessons is on the right of the page.

http://nehe.gamedev.net/

They're aimed at Windows originally, and texture mapping starts around lesson 6. I recommend just going through them one lesson at a time, implementing/porting them in Warp3D and asking on here for the equivalent Warp3D functions.

It's a little more involved but everything, certainly at this stage, is really simple and shouldn't require more than a few nudges and hints from people :)

Good luck.

Offline Minuous

Re: Warp3D tutorials
« Reply #4 on: April 13, 2012, 03:40:23 PM »
Yes, I'm nearly finished implementing the feature using Direct3D for the Windows version and then might try implementing that functionality via Warp3D for the Amiga version. I will rotate the object which will obviate the need to move the camera.
 

Offline smerf

Re: Warp3D tutorials
« Reply #5 on: April 13, 2012, 06:36:26 PM »
Hi,

@all,

You know why Karlos knows som much about Warp 3D, probably because he is warped. After all it takes one to know one

smerf
I have no idea what your talking about, so here is a doggy with a small pancake on his head.

MorphOS is a MAC done a little better