Topic: Few questions

Hi and first thank you for this awesome soft!

I have a few questions about maratis and to dont polluate i will ask all them here:

Invisible bounding box
The invisible bounding box in the examples, i guess it is bind to the model in blender and then exported ? how can i reproduce it ?

Feet Box
The feet box under the 3d models in YoFrankie and Jules example, what does it stand for ? what are the advantages
of using one ?

GUI and images
I've read in another topic, theres a way to attach it to the camera
But i really dont see how this can be done (i mean, how can i display my images, healthbars etc ?)

Display Mouse
Is it possible ?

edit/ one more for the road
Skyboxes
How can i set one ? i tried some things with different render settings but in the end i failed

Thank you

Last edited by Vegas (2011-03-07 10:58:26)

Re: Few questions

Hi there !

Invisible bounding box :
In the entities properties there is an "invisible" button to push on. So in the examples, the bounding boxes are in fact just box exported from blender, imported as an entity, and set as "invisible". You can use the mesh you want, like a sphere for example. An invisible mesh can also be used as a trigger when set as "ghost" (physics properties).

Feet box :
It's just a logic thing, if you want to know if the player touch the ground it is a simple way to do it. Because if you test if the main box is colliding with the room, it will detect also when colliding with the walls (we don't want). Because the main box is larger than the feet box, the feet box only touch the ground.

Gui and images :
Idea is to attach your GUI to the camera (look at the "video tour" in the website to see how to attach objects). If your GUI is 2d, just do a quad in blender and set your image as the diffuse texture. On Maratis, import your GUI as entities, turn the objects to face the camera and attach to the camera.

> it's not a pretty solution but it's the only one working without coding. Best way is to manage the GUI using a game plugin in C++. I'll try to release more examples.

Display mouse :
It's possible only using the game plugin system.

SkyBoxes :
A very simple way is to create a box in blender. To render skybox texture, render 6 images with a 45 degree fov camera, West, Est, North, South, Up and Down. Then Put each texture in the sides of the box. Set the textures as diffuse, and put material "Emit" at (1, 1, 1).

> Import the mesh in Maratis, go to the behavior tab and add a "Follow" behavior. Set the camera name as the target, set delay to 0. Scale the skybox to fit the clipping max of the camera. The skybox will follow the camera position but will not rotate with t, so it's the definition of a skybox.

If you have more question don't hesitate.
bye,

video tour : http://www.maratis3d.org/?p=477
how to make a game plugin : http://www.maratis3d.org/?p=500

Re: Few questions

Link selection ! that was that.
I watched the video (of course) but seems i missed that part...
And i see now for the Feetbox. that make sense.

anael wrote:

An invisible mesh can also be used as a trigger when set as "ghost"

This tip will be very useful too

For the skyboxes, mine is almost ok, gonna make a tutorial once its perfect

anael wrote:

Display mouse :
It's possible only using the game plugin system.

For the plugin system unfortunately i'm ultra allergic to C++ (can be mortal!) so i cant go this way

Thanks for your help !

anael wrote:

If you have more question don't hesitate.

Preparing my next batch of noob questions
and im back
wink

Re: Few questions

And im back!

Animated GIF

.gif files can be applied to a mesh ? i've seen on blender export help page
"Images" and "Clip" are supported so i was wondering, that might help for a GUI

Reflections

I want to achieve 2 things, one soft reflection like this one :
http://img5.imageshack.us/img5/6008/ok2d.gif

First i tought that was done by baking textures but then i've found this :

Baking reflections and specular highlights is a bad idea if you want to move the camera, the object or any of the lights. The position and content of the reflections and highlights depend on their relative positions.

And a 100% mirror reflection one.

I made lots of tests in blender but still failed in the end
any ideas ?

Shaders

Let's say i want to make a cell shaded game, i guess i have to set a custom shader in blender export ?

Searching a bit i found these 3 tools :

http://developer.nvidia.com/object/fx_c … l#features
http://developer.amd.com/archive/gpu/re … fault.aspx
http://glintercept.nutty.org/index.html

Will i be able to set my own shader in blender export with these or there's an easier way ?

Shooting Bullets

This one is giving me hard times.

Logically i think :
(no lua script, just to tell how i imagine the thing)

when a key is pressed
create "Bullet" every 0.5seconds at position (gun.x, gun.y, gun.z)
(with bullet going on the good direction at the good speed ofc)
Destroy "Bullet" on collision

But yeah i know, it's not that easy.

For now: i have a character, a gun attached to him, and a bullet attached to the gun >.<
Problem is when i shoot, the bullet is coming back on the gun (follow behavior)
wich doesnt look really realistic xD

Is there a "Create Object" option or equivalent ?
Also, i havn't found a way to move an object at another object position without using follow behavior so here is it, my next question :

Place an objet at another object position

Let's say :

I want OBJECT1 to move at OBJECT2 position when i push a key

Logically i just think :
(no lua script, just to tell how i imagine the thing again)

when a key is pressed
setPosition(OBJECT1, {OBJECT2.x+2, OBJECT2.y+4, OBJECT2.z-2})

But yes once again its not that easy and im kinda stuck for now

/cry

Last edited by Vegas (2011-03-10 17:09:11)

Re: Few questions

fast reflections are mostly done with an envmap (environment map)

and i also asked for cel shading (for the outline to be exact) - see here
http://forum.maratis3d.com/viewtopic.php?id=56

Re: Few questions

Kralle wrote:

fast reflections are mostly done with an envmap (environment map)

and i also asked for cel shading (for the outline to be exact) - see here
http://forum.maratis3d.com/viewtopic.php?id=56

Oh i missed that topic

I remember this technique for cell shading, found on anim8or site years ago ^^
http://www.anim8or.com/tutorials/from_u … _hints.jpg

Also for envmaps i was thinking about that yes but mapping : Reflection has to be applied
for good results and currently only UV are supported thats why i tried my luck
with baking, but i cant get something decent out of this..

thanks anyway

Re: Few questions

Hi,

Animated gifs:
They are not supported, if you want to use animated textures, you'll have to make a single texture strip including multiple images, then animate texture translate to decal your texture in time.

Bullets:
There is a way to do it by script, but I should say that it will be more easy and optimized to use a c++ game plugin.
Look at Maratis/Examples/Demos/scripts/follow.lua to have a look on a more complex lua script to move objects.
Later, I'll try to give you a better example.

About shaders :
Create a custom shader will be the best to have your reflexion effect, in this case, as Kralle suggested, an envmap will be good enough.

A spherical envmap like this one for example :
http://www.codemonsters.de/home/img/textures/spheremap_bar.jpg

You can link shader using Maratis Blender export :
http://www.maratis3d.org/wp-content/uploads/2011/01/05.jpg

You can access each texture slot with your custom shader
http://www.maratis3d.com/wp-content/uploads/2011/01/06.jpg

To create shaders, you can just use a text editor, as Maratis is updating assets in realtime, each time you will modify and save your shader, the result will automatically appear on Maratis.

To create a reflexion using a shader, you can use the normals as uv coord, something like :

VERTEX SHADER:

attribute vec3 Vertex;
attribute vec3 Normal;

uniform mat4 ModelViewMatrix;
uniform mat4 ProjModelViewMatrix;
uniform mat4 NormalMatrix;

varying vec3 position, normal;

void main(void)
{
    normal = (NormalMatrix * vec4(Normal, 1.0)).xyz;
    position = (ModelViewMatrix * vec4(Vertex, 1.0)).xyz;
    gl_Position = ProjModelViewMatrix * vec4(Vertex, 1.0);
}

FRAGMENT SHADER:

uniform sampler2D Texture[8];
varying vec3 position, normal;

void main(void)
{
    vec3 N = normalize(normal);
    vec4 reflection = texture2D(Texture[0], N.xy);
    gl_FragColor = reflection;
}


This example is only showing how to make an envmap, for a full shader including texture, diffuse, normal map, you can have a look to the standard Maratis shaders, located in the source distribution : Maratis/Common/MRenderers/MStandardShaders.h

When I'll have some time, I'll try to give a standard shader that can be used as a start.

Anaël.

Re: Few questions

I'm a bit confused.

I did like u explained, so now i made 2 files in my project/shader folder,
one Reflect.vert and Reflect.frag

Applied custom shader in blender, etc
But now i tried to export like 30 times with differents settings at each try,
most of the time in game my object is displayed black without reflexions

I'm doing something wrong for sure but i dont see what
Anyone kind enough to show me the correct settings ? :x

And thanks for your help smile

Re: Few questions

Look in the console window of Maratis if some error is printed.
If you want a shader example there is one in there : "Example/Demos/shaders/"

I'll try to send a tested reflexion shader soon.

Re: Few questions

hm there's no error log in maratis console so i guess it's me failing with blender somewhere =x

Another quick question,

About image transparency, its me failing again or it is not supported yet ?

Tree in blender:

http://img860.imageshack.us/img860/263/image131951compressed.jpg

Exported :

http://img6.imageshack.us/img6/5481/image121650compressed.jpg

Re: Few questions

Hi,
for the tree, for hard transparency,
your foliage texture just need to have an alpha component
using pnj format for example.

The yo-frankie demo is using transparency for trees, i included the blend files
if you want to compare with your tree.

Re: Few questions

http://img130.imageshack.us/img130/7302/image1555compressed.jpg

Perfect, thank you smile

Re: Few questions

Hi, nice smile

I release a new example with envmap shaders if you want to have a look :
http://www.maratis3d.org/?p=548

Re: Few questions

Fantastic, that's exactly what i needed !

Now i have everything i needed to make a good looking scene

Gonna post the results soon

you rock wink

Re: Few questions

Hmm one last problem for now, i have trouble with triangle-mesh shape.

To describe the problem its like my car/hero is colliding with an invisible thing on the floor
(comme si ils trébuchaient / se font bloquer par un truc, meme quand le surface est plate)

On a simple flat road for exemple for now i can set shape to convex-hull and its just perfect but
when i want to use more complex models like a terrain with hills or a twisted road i have to use triangle-mesh
but then its not playable

I tried with/without feet & bounding box, differents settings editor, in both way result is the same.
Tried to copy settings from Yorankie exemple too, as i noticed the level is in triangle-mesh too and dont have this problem but .. not working for my models :x

Any ideas ?

Re: Few questions

are you using very large triangles ?
it's possible that bullet physics need subdivide surface when it's large.

Re: Few questions

One thing i forgot to say, its when i use angularFactor that this problem happen

For the triangles, i tried :

- 30k triangles terrain
- 10k triangles terrain
- 622 triangles terrain
- with / without subdivide surface

Honestly i didnt noticed any major differences =x

Also noticed i dont have much problems with a very small terrain, but when i scale it to make a huge one it happen

Re: Few questions

Question - what form has your collision box for the car/hero?
is it boxs shaped or a cylindrical sphere (also called: collisionTube)?
Box shapes tend to get stuck on ground, at spikes or holes - round shape not.

P.S. No idea if maratis3d supports that shape...
as ref: collisionSolids in panda3d
http://www.panda3d.org/manual/index.php … ion_Solids

Last edited by Kralle (2011-03-16 17:04:43)

Re: Few questions

Oh, i'm using box-shaped only for now
i'm gonna try this in about 1hour (must do something right now)
Gonna post the results after that

Thank you

Re: Few questions

Hmm still the same, but now im sure its a problem with angularFactor, cause
when i dont use it, it runs just perfect.

Gonna toy around with the settings and hope for a win >.>

Re: Few questions

try using "spherical" shape or "capsule" shape.
As you are changing the angularFactor and using a box shape, it's possible that the edge of
the box shape is being stuck because you don't allow it to rotate.

look at yo-frankie example, it use a transparent box for the collision, but the physics shape is "sphere"

Re: Few questions

anael wrote:

try using "spherical" shape or "capsule" shape.
As you are changing the angularFactor and using a box shape, it's possible that the edge of
the box shape is being stuck because you don't allow it to rotate.

look at yo-frankie example, it use a transparent box for the collision, but the physics shape is "sphere"


Well thing is, when AngularFactor is set to 0.00 theres no collision problems, but without any angle rotations,
a car on a terrain with hills looks pretty bad

When i set angularFactor to 1.00 (or even 0.xx) with (box shape) angles rotations are good but theres collisions
making it unplayable

still with angularFactor to 1.00, with sphere or capsule shape this time, my model is doing 360° rotations even on a flat plane so its a bit hard to make tests ^^'

I'm sure is just a simple value to change somewhere but nvm i will stay with a flat plane for now, and take a deeper look later on

Re: Few questions

Hello, another batch of questions, here we go :
-------------------------
Timer, Timeline

Is it possible to manage the time ?
that would greatly help for sounds, lights and others object changes

for example let's say i want to make a progressive FOV change,

if isKeyPressed("X") then
setcamerafov (cam, 90)
(timer here, lets say 0.1 seconds)
setcamerafov (cam, 100)
(timer here, lets say 0.1 seconds)
setcamerafov (cam, 110)
etc

And also, i dont see how i can use the timeline for now ? cause i dont find any scripts
related to time

------------------
Non-bones blender animation

Is it possible to export animations WITHOUT using bones directly from blender to maratis ?
i mean just scale/rotate/translate animations

and possibly cloth/fluid modifier for water effects
-------------------

Animation Blending

Currently, is that possible?

------------------

Sorry for many questions, just want to make 100% sure

Re: Few questions

Timer, Timeline:

The lua script update is syncronised at 60fps,
so you can create a timer with a simple variable like that :

t = 0

function onSceneUpdate()

    -- 1 second
    if t == 60  then
        print("one second")
    end

    t = t+1
end


Non-bones blender animation :

The actual blender python script is not implementing it,
that's possible in the future, if a contributor can improve the python script
it would be nice.


Animation Blending :

Currently not, I made some code for morphing, but I'm not sure I finished it, laking of time.
I will try to have a look at it at some point.

Re: Few questions

Alright thanks, wish i can help but my programming skills are so fail that its not possible

as proof i took 4 hours trying to set a delay to play 1 sound after another one. and still failed.
Note, i can set events at a given time, its working perfect, like this one, starting rotating after 4seconds

if (t > 240) then
    rotate(mini, {0, 0.4, 0}, 3, "local")
end

but what im trying to do here is for example
execute one action 3sec after the previous one, or every 3sec (regardless of the timeline, like a 1sec delay or an imaginary "wait" option), that kind of stuff.

ive made a "delay" variable and tried to toy with t= / t> / t< (dont even know if thats the right way to do it)
but nothing worked

Once again im crying for your help sad

s1 = getObject("s1")
s2 = getObject("s2")


   t = 0
   sound = 0
   delay = 0

-- scene update
function onSceneUpdate()
   
    -- 1 second   
    if t == 60  then       
       print("one second")   
    end
   
    t = t+1
   
    -- Sound
    if isKeyPressed("X") then
        if sound == 0 then
            playSound(s1)
            delay = 1
            playSound(s2)
        end   
        sound = 1
    else
        sound = 0
    end
   
    -- delay
    if delay == 1 then
     then.. then what ? ><
    end

end