amiga.org
     
iconAll times are GMT -6. The time now is 10:51 AM. | Welcome to Forum, please register to access all of our features.

Amiga.org Operating System Specific Discussions Amiga OS Amiga OS -- Development Warp3D tutorials

Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS.

Reply
 
Thread Tools Display Modes
Old 04-12-2012, 10:55 AM   #1
Minuous
Premium Member
Points: 10,535, Level: 68 Points: 10,535, Level: 68 Points: 10,535, Level: 68
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Jan 2003
Posts: 521
Default Warp3D tutorials

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.
Minuous is offline   Reply With Quote
Old 04-12-2012, 12:02 PM   #2
Karlos
Sockologist
Points: 50,618, Level: 100 Points: 50,618, Level: 100 Points: 50,618, Level: 100
Activity: 5% Activity: 5% Activity: 5%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: Barishabaad, Sardistan
Posts: 16,667
Blog Entries: 18
Default Re: Warp3D tutorials

Quote:
Originally Posted by Minuous View Post
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:
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.
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB

Last edited by Karlos; 04-12-2012 at 12:07 PM..
Karlos is offline   Reply With Quote
Old 04-13-2012, 02:37 AM   #3
woof
Hobbyist
Points: 7,965, Level: 60 Points: 7,965, Level: 60 Points: 7,965, Level: 60
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Feb 2003
Posts: 61
Default Re: Warp3D tutorials

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
woof is offline   Reply With Quote
Old 04-13-2012, 06:50 AM   #4
AJCopland
Cult Member
Points: 8,079, Level: 60 Points: 8,079, Level: 60 Points: 8,079, Level: 60
Activity: 4% Activity: 4% Activity: 4%
 
AJCopland's Avatar
 
Join Date: Jul 2006
Posts: 854
Default Re: Warp3D tutorials

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.
AJCopland is offline   Reply With Quote
Old 04-13-2012, 08:40 AM   #5
Minuous
Premium Member
Points: 10,535, Level: 68 Points: 10,535, Level: 68 Points: 10,535, Level: 68
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Jan 2003
Posts: 521
Default Re: Warp3D tutorials

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.
Minuous is offline   Reply With Quote
Old 04-13-2012, 11:36 AM   #6
smerf
Defender of the Faith
Points: 12,809, Level: 73 Points: 12,809, Level: 73 Points: 12,809, Level: 73
Activity: 2% Activity: 2% Activity: 2%
 
smerf's Avatar
 
Join Date: Mar 2002
Location: Pennsyltucky, USA
Posts: 1,609
Blog Entries: 1
Default Re: Warp3D tutorials

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
smerf is offline   Reply With Quote
Reply

Bookmarks

Tags
tutorials , warp3d

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump