Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
11 questions about U3d; U3d errors
Topic Started: Jul 13 2006, 05:22 PM (802 Views)
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
I'm making a strategy and a car simulator game, but there are a lot of obstacles in the DLL.

SpriteMaker
___________

1. It saves without file extension (*.bmp)
2. I'm usually using black & white collision sprites for objects so it would be great, if there is an option "render in black & white".

Ultimate3D
__________

1. texx1, texy1, texx2, texy2 - can't change under step event with floors and billboards, I want to make animated billboard.
2. partsx, partsy - single floor (not parts, it will leave lines to connection points, with tile mapping would fix the problem.
3. Smooth edges of opacity maps aren't quite correct, and half transparent maps too (for example windows of the building, 3d objects are invisible through them), SetFilter(0) 0 = No filter did not fix that bug.
4. In car game, headlights cannot keep up with the car, it is also in your Demo.gm6 (lights are flashing, when you drive).
5. I wanted to make realistic sea, but there is no way to change floor texture offset, so I did that effect with moving whole floor.
6. DrawTex script should contain originx & originy arguments to set an anchor point of texture, for example I want to make a car speedometer I need to set anchor point to center of the speedometer hand.
7. I made my own 3D spherical atmosphere (so I can rotate it and change it's transparency to create clouds moving and darkening effect, but then I can't use fog (cause it will conceal my atmosphere) so I need to set fog maximum height.
8. DrawText scripts can't use ASCII characters (for example ä), but I need to use them.
9. If there are two floors near each other, an you go higher with the camera weird lines appear, two floors will mix up.
10. no_light=1 won't work on billboards and floors maybe on other Ultimate 3D shapes too.
11. Ultimate 3d uses world pivot on 3ds models (parallel to horizon), but I need local pivot, to make car jump (so the car axle becomes x axis).

NB! In the DemoGM6, Sprite names are equal to object names, use Check Resource Names & Check All Scripts command under Scripts menu to avoid script errors.

Maybe most of those bugs will be fixed in U3d 2.0.
Offline Profile Quote Post Goto Top
 
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
The car simulator game is already abandoned because of error 11.
Offline Profile Quote Post Goto Top
 
Zip
Member Avatar
Forum Leader
[ *  *  *  *  * ]
for problem #11:
if you have a 3d modeler simply move the car in a way to have the pivot of the car at 0,0,0 (x,y,z)

for the sprite maker, save the file with its extension like "car.bmp" and with the game maker sprite editor make the sprite b&w.
If you have separate model fo the car chassis and the wheels (i think it's the best way) use some trigonometrics to place them at the right place, so when you rotate the car they remain at 'home' position respect the car. So you can make dumper too ;)
Sorry if i've made some errors, I'm not english!
Offline Profile Quote Post Goto Top
 
sherif
Member Avatar
Advanced Member
[ *  *  * ]
Quote:
 
2. I'm usually using black & white collision sprites for objects so it would be great, if there is an option "render in black & white".

you can concver it by you self in some seconds using paint
admin of anivit.sk (canina)
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Many quentions. I hadn't got time to anwer them in the past few days because I had technical difficulties with my laptop <_< . But I'll try to answer all of them now.

Sprite Maker:

1.: I'm gonna fix this when I release the next version of this program. Until then you have to write *.bmp behind the filename when selecting the destination file.

2.: I agree with Zip and sherif. You should be able to generate these on your own using image editing software (such as Gimp ;) ).

Ultimate 3D:

1.: Only x, y, z, rotx/y/z, scalx/y/z, texture and no_light get updated by the Step script. If you want to update the other variables you have to recreate the object using a code like the following in the step event:
Code:
 
if(texx1!=texx1previous || texy1!=texy1previous || texx2!=texx2previous || texy2!=texy2previous){
   Destroy();
   Create2D(); // or whatever
   texx1previous=texx1;
   texy1previous=texy1;
   texx2previous=texx2;
   texy2previous=texy2;
}


2.: Don't get what you mean by that :dunno: .

3.: For proper edges of partitially transparent textures you have to use textures that use resolutions made up of powers of two. For more information see this topic.

4.: Simple lighting is always vertex based, which means that a lighting color is calculated for every vertex in every step based on the properties of this vertex and the properties of the light sources. Then the colors of the three surrounding vertices get interpolated over the triangle. In U3D 2.0 there will be alternative possibilities for lighting such as the per pixel lighting in combination with normal maps or projective light mapping using multi texturing and vertex shaders.

5.: See point 1.

6.: I may add something like this to a later version of U3D. Anyway it can be also solved using a bit trigometry (Increase your math knowledge and make some nice graphics :yahoo: ;) ).

7.: You can use a vertex shader that doesn't use lighting and fog such as this one:
Code:
 
vs.1.1                 ; Vertex shader version 1.1
dp4 oPos.x, v0, c4     ; Calculate the x position on the screen
dp4 oPos.y, v0, c5     ; Calculate the y position on the screen
dp4 oPos.z, v0, c6     ; Calculate the z position on the screen
dp4 oPos.w, v0, c7     ; Calculate the w position on the screen
mov oT0, v7            ; Pass the UV coord
mov oD0, c12           ; Use the material color


8.: That problem is difficult to solve. If Game Maker passes a string to a *.dll (such as U3D) it uses 8-byte characters. So there are 256 possible different characters interpreted using the ASCII character set. I can't change that. But you could use DrawTexEx to write a script that uses a texture with a number of different characters to draw text. This way you could define your own character set.

9.: This is due to the unprecisision of 16-bit z-buffering. On the PCs that support it U3D will use 32-bit z-buffering in the next version.

10.: The tree billboards in the demo use no_light so I guess it works ;) . Make sure that you are calling Step().

11.: Please describe a bit more detailed what you mean by this. I'm sure it's solvable using trigonometry. Maybe it can be solved even easier.
Offline Profile Quote Post Goto Top
 
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
Oops, I forgot to Log In.
:unsure:

There should be variable for this, boolean local_pivot.

If local_pivot is false then coordinate system is like now (U3d v.1.3) else its by the Local pivot.

3. I made image in power of 2 (256x256) and mask 100 % transparent and no smooth on mask, but still edges remain (although it slightly reduced those nasty edges).

6. I already used a formula for that, and that works.

I think this is somekind of rendering system, I have seen same bug in some older 3D games.
Posted Image

Here is a image about animated billboard:
Posted Image

10. Ofcourse I used Step(), but maybe it is caused by the fog, not the light.
Posted Image

Here are some screenshots about uncompleted cargame:
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
So you want to move the object in it's local coordinate system, right?
You can use the following script to do this. I didn't test it but it should be working.
Code:
 
// MoveObjectInLocalCoordSys(objectid, x, y, z)
temp_rotx=degtorad(argument0.rotx);
temp_roty=degtorad(argument0.roty);
temp_rotz=degtorad(argument0.rotz);
rot_11=cos(-temp_rotz)*cos(-temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);  rot_12=sin(-temp_rotz)*cos(-temp_rotx); rot_13=cos(-temp_rotz)*sin(temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_21=sin(temp_rotz)*cos(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);   rot_22=cos(-temp_rotz)*cos(-temp_rotx); rot_23=sin(-temp_rotz)*sin(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_31=cos(-temp_rotx)*sin(-temp_roty);                                                  rot_32=sin(temp_rotx);                  rot_33=cos(-temp_rotx)*cos(-temp_roty);

argument0.x+=argument1*rot_11+argument2*rot_21+argument3*rot_31;
argument0.y+=argument1*rot_12+argument2*rot_22+argument3*rot_32;
argument0.z+=argument1*rot_13+argument2*rot_23+argument3*rot_33;

Note that this script ignores the scaling of the object.

Edit: I can't see the images you added by editing your post. Seemingly your host doesn't allow remote linking like this. Please upload them on another server or at www.imageshack.us .
Offline Profile Quote Post Goto Top
 
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
Dr. Best
Jul 16 2006, 03:50 PM
So you want to move the object in it's local coordinate system, right?

No, I want to rotate object in it's local coordinate system (object itself, car model).

6. That was just a suggestion I've already used a formula for that.

10. It was the fog after all, what was affecting the floor color somehow (other objects where not foggy).

3. And those nasty edges, through them only U3D objects will be displayed (no *.3ds models).
Here is a screenshot about your U3D demo, when I resampled demo palm.png to
512x512 instead of 521x749,
still edges remain nasty.
Resampling won't fix the problem, using black world bacground and 3ds atmosphere
conceals it a bit.

Posted Image
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Ok, point eleven is already solved:
http://s9.invisionfree.com/Ultimate3D_comm...ndpost&p=524932

On your problem with the edges. The edges are not fully transparent, because they get filtered in a linear way. That's why they may cover other stuff. There are two processes where the texture can get filtered. The first one is when loading. This can be avoided by using the powers of two for the texture dimensions. The second process is the texture sampling that is done while rendering. When using nearest-point-sampling you won't get these edges anymore. But the price would be high. In U3D 2.0 you could use multi-texturing to use linear filtering for the color and nearest point sampling for the alpha channel.

BTW
the screenshots of the racing game look pretty cool.
Offline Profile Quote Post Goto Top
 
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
I used vertex shader, that you gave, but it wont work, no light worked but still fog covers the atmosphere.

When I used vertex shader like this it was better, but still fog remained...

vs.1.1

//Transform Pos
dp4 oPos.x, v0, c4
dp4 oPos.y, v0, c5
dp4 oPos.z, v0, c6
dp4 oPos.w, v0, c7

//Use the material color
mov oD0, c12

//Calculate the fog value
dp4 r1.x, v0, c2
add r0.x, r1.x, -c13.w
add r0.y, c13.z, -c13.w
rcp r0.y, r0.y
mul oFog.x, r0.x, r0.y

//Pass the UV-coords
mov oT0, v7

... and set constant in step.

SetVSConstant(13,0,0,1000,2000) //SetVSConstant(13,0,0,fog start,fog end)

If I'd get that work, then point 10 would be solved too.
When I did underwater scene, seabed was covered with fog just like in point 10.

1. & 5. soulution seems preposterous to Create() & Destroy() in step event, so it's better to move floor than change it's texture offset,
but to make animated billboard is it possible to make LoadTexture(path,number,width,height) to LoadTexture(path,number,width,height,left,top), to load part of the texture.

2. That is not important thing, compared to point 3. I can deal with it.

And about point 4. in cargame, I think I will make car headlights in other way, with vertex shader.

11. Thanks, that worked (local pivot rotation), but now I need to get wheels in place, I used script MoveObjectInLocalCoordSys(objectid, x, y, z) what you gave me before,
and //move(c.rotz*-1,c.roty-90,7.4) for left rear wheel, neither of them did not work.

And by the way are you on M. Schumacher side? Just asking.


Posted Image
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Try using this vertex shader. It sets the fog value always to zero. I thought if I wouldn't assign a value to it it would be zero, too, but seemingly that's not true.
Code:
 
vs.1.1               ; Vertex shader version 1.1
dp4 oPos.x, v0, c4   ; Calculate the x position on the screen
dp4 oPos.y, v0, c5   ; Calculate the y position on the screen
dp4 oPos.z, v0, c6   ; Calculate the z position on the screen
dp4 oPos.w, v0, c7   ; Calculate the w position on the screen
mov oT0, v7          ; Pass the UV coord
mov oD0, c12         ; Use the material color
mov oFog.x, c0.w     ; Set the fog factor to 0 (the fourth element of the first matrix line will be always 0)


There's no efficient way to implement a function like the one you suggested. You should better solve it by changing the texture coordinates. You could also use a vertex shader to do this.

I think there's a small misstake in the MoveObjectInLocalCoordSys-script above. I forgot that the matrix uses another coordinate system than GM. Try this modified version:
Code:
 
// MoveObjectInLocalCoordSys(objectid, x, y, z)
temp_rotx=degtorad(argument0.rotx);
temp_roty=degtorad(argument0.roty);
temp_rotz=degtorad(argument0.rotz);
rot_11=cos(-temp_rotz)*cos(-temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);  rot_12=sin(-temp_rotz)*cos(-temp_rotx); rot_13=cos(-temp_rotz)*sin(temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_21=sin(temp_rotz)*cos(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);   rot_22=cos(-temp_rotz)*cos(-temp_rotx); rot_23=sin(-temp_rotz)*sin(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_31=cos(-temp_rotx)*sin(-temp_roty);                                                  rot_32=sin(temp_rotx);                  rot_33=cos(-temp_rotx)*cos(-temp_roty);

argument0.x+=argument1*rot_11+argument2*rot_31+argument3*rot_21;
argument0.y+=argument1*rot_13+argument2*rot_33+argument3*rot_23;
argument0.z+=argument1*rot_12+argument2*rot_32+argument3*rot_22;


The reason for the problem on the screenshot is simple: The fog is calculated on vertex base. That means one fog value gets calculated for every vertex based on it's distance to the camera and then it gets interpolated over the triangle. So to solve this problem you have to increase the vertex count of this object. Or you use a vertex shader to program an alternative fog calculation method. But finding one that works really well for objects with less vertices is difficult.

P.S.: I don't care about the Formula One ^_^ .
Offline Profile Quote Post Goto Top
 
Evolver
Member Avatar
Advanced Member
[ *  *  * ]
No fog vertex shader still doesn't work,

When I used vertex shader like this,
And used SetVSConstant(13,0,0,-fog_start,-fog_end) in step event,
it works perfect, no fog on sky, but why script that you gave does not work.

Code:
 

vs.1.1
//Transform Pos
dp4 oPos.x, v0, c4
dp4 oPos.y, v0, c5
dp4 oPos.z, v0, c6
dp4 oPos.w, v0, c7

//Use the material color
mov oD0, c12

//Calculate the fog value
dp4 r1.x, v0, c2
add r0.x, r1.x, -c13.w
add r0.y, c13.z, -c13.w
rcp r0.y, r0.y
mul oFog.x, r0.x, r0.y

//Pass the UV-coords
mov oT0, v7


LocalMove:

I tested it in many ways, but I can't get it work, could you look over LocalRotate(), SetRotate() and LocalMove() scripts,
maybe you forgot that the matrix uses another coordinate system than GM again,
because when I use LocalRotate(), car turns upside down, and SetRotation(rotx,roty,rotz) doesn't seem to work.

I would like MoveObjectInLocalCoordSys(objectid, x, y, z) to be like that, because otherwise it's confusing for me.

Code:
 

//LocalMove(objectid, x,y,z)
temp_rotx=degtorad(argument0.rotx);
temp_roty=degtorad(argument0.roty);
temp_rotz=degtorad(argument0.rotz);
rot_11=cos(-temp_rotz)*cos(-temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);
rot_12=sin(-temp_rotz)*cos(-temp_rotx);
rot_13=cos(-temp_rotz)*sin(temp_roty)+sin(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_21=sin(temp_rotz)*cos(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*sin(-temp_roty);
rot_22=cos(-temp_rotz)*cos(-temp_rotx);
rot_23=sin(-temp_rotz)*sin(-temp_roty)+cos(-temp_rotz)*sin(-temp_rotx)*cos(-temp_roty);
rot_31=cos(-temp_rotx)*sin(-temp_roty);
rot_32=sin(temp_rotx);
rot_33=cos(-temp_rotx)*cos(-temp_roty);

x+=argument1*rot_11+argument2*rot_31+argument3*rot_21
y+=argument1*rot_13+argument2*rot_33+argument3*rot_23
z+=argument1*rot_12+argument2*rot_32+argument3*rot_22


and I'll use script like this then.

Code:
 

c=id //local variable, car id
REV=Speed/degtorad(3.67)

//rear left wheel
with wheel[3]
{
x=c.x y=c.y z=c.z
SetRotate(c.REV,c.roty,c.rotz)
LocalMove(c,7.4)
Step()
}
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply