Jump to content

isidisi

Members
  • Posts

    94
  • Joined

  • Last visited

Posts posted by isidisi

  1. I'm not sure if changing the materials will be possible in Leadwerks3D, because it is not yet released. :blink:

     

    In Leadwerks Engine 2 there is no way to change the material for a specific instance of a model. You

    pretty much have to copy the .gmf file and rename it. That way it is the same model but you can use a

    different material for it.

     

    Yes I know this, but is not a clean solution. It will be better to add a parameter to LoadMesh function in a future version. Same with materials...

  2. I need to change materials of meshes dynamically(using PaintSurface) and I find the following problem:

     

    If I load the same .gmf using LoadMesh 2 times, LoadMesh returns the same reference. Thus when change a material in first object with PaintSurface, also changes in the second.

     

    Is there any way to load gmfs more than once and get diferent instances, to change the materials independently?

     

    Thanks

  3. I see you have Renderer:DrawTop() that does the drawing. By having it where it is, wouldn't the top layer be subject to post processing effects? It looks like it's drawn after all of that. If this was use for a GUI you wouldn't want that I would think.

     

    I assume we can just do the code in the RenderTop() after the normal framework render code runs though.

     

    Yes I think so, is run this code after normal stuff... And sure is not be subject of postprocessing efects, is after...

  4. That works great! I'll play around to get something working with C#. Would be cool if the framework could be more flexible to allow us to define worlds on the fly and decide in what order the worlds work without editing the framework source.

     

    Yes look at DrawTop new function(). Is a copy of the other for other layers.

     

    But it has

    ClearBuffer(BUFFER_DEPTH);

     

    line :-)

     

    And it would be nice to be possible to tweak the new Framework embedded in the engine... the one we have modified is de 2.28 version code and with time it will get older and without updates of the other...

  5. I have done some time ago but outside framewerk in a simpler way, hidding top objects and rendering others, clearing zbuffer, and then hiding normal objects and rendering top objects... but is the same idea, clear zbuffer and then all thing you render is on top.

     

    I checked my code, I used this to draw on top coordinate axis... I rendered main world, lights, then cleared zbuffer and draw axis... but the axis was drawn with only ambient light... that was ok for me... is ok for you too? I'm not sure how to add other kind of light to top objects, but for me was ok only ambient...

     

    Look I modified framewerk, add some object (as axis) to new TopWorld and it will be rendered on top of all (with ambient light) hope it helps al little at least...

    Top.zip

  6. Hey isidisi, have you done this before? Do you know how to get it working along side the framework?

     

     

    I have done some time ago but outside framewerk in a simpler way, hidding top objects and rendering others, clearing zbuffer, and then hiding normal objects and rendering top objects... but is the same idea, clear zbuffer and then all thing you render is on top.

     

    I checked my code, I used this to draw on top coordinate axis... I rendered main world, lights, then cleared zbuffer and draw axis... but the axis was drawn with only ambient light... that was ok for me... is ok for you too? I'm not sure how to add other kind of light to top objects, but for me was ok only ambient...

  7. I think render last doesn't mean render top.

     

    To render a world on top of another is necessary to clear zbuffer between renderworld calls.

     

    After rendering background world zbuffer is cleared, so main world and transparency world are always on top of background.

     

    But after rendering main world zbuffer is not cleared, so transparency (foreground) world is not rendered on top of main world, only is rendered later for good transparency drawing.

     

    I think the better is to create a 4th top world that renders after transparency world, and clear zbuffer before rendering it. This will be a topmain world. We can also create a 5th toptransparent world to render top transparent objects after top objects...

  8. You should put 3D GUI models in the foreground world, then they are always on top of other models, and the transparency works correctly (including cascaded transparency and shadows through them).

     

    Is there a foreground world in framewerk? I have 2.28 version of Leadwerks, in my version only background, main, and transparency worlds exists...

  9. If they were in a different world I would think/hope so because in the picking you have to give the camera and that world would have it's own camera. I think :)

     

    I think you can do in a similar way as Framewerk does to draw main world over background world.

    Create a world with top entities. After draw normal entities, do a

     

    ClearBuffer(BUFFER_DEPTH);

     

    then set top world and render it. As tou have cleared depth buffer all thing are drawn on top. (See DrawBackground function of Renderer.cpp)

  10. I tried and not works, when I do RenderWorld() Leadwerks Engine changes projection matrix with the parameters of the world's camera... is there a way to avoid this?

     

     

     

    I tried adding some lines in Renderer.cpp:

    float test[16]; //To check changes in projection matrix.

    glMatrixMode(GL_PROJECTION);

    ::glLoadMatrixf(myProjectionMatrix);

    ::glGetFloatv(GL_PROJECTION_MATRIX, test); //Here test = myProjectionMatrix

     

    // Render the scene

    Wireframe( wiremode );

    ::glGetFloatv(GL_PROJECTION_MATRIX, test); //Here test = myProjectionMatrix

    RenderWorld();

    ::glGetFloatv(GL_PROJECTION_MATRIX, test); //Here test != myProjectionMatrix, RenderWorld changed projection matrix before rendering :-(

  11. Is posible to change the projection matrix of the camera to a custom matrix?

     

    I want to do a 4 x 4 grid, where each tile is a render in order to later join them and obtain a bigger image... then I have to displace and scale after projection matrix in the camera to render each tile.

     

    I tried with SetEntityMatrix but it seems not to set the projection matrix, only position and rotation of the camera...

     

    Any help?

  12. I have debugged with glslDevil and I found that the call that Leadwerks is doing when I set ShadowmapSizeto 512 is:

     

    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

     

    if I set ShadowmapSizeto 1024 then I see in the debugger:

    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

     

    so always is creating a texture 2 * ShadowmapSize

     

    Then we have to divide by 2 the max texture calculated in the routine I posted.

    resWidth /= 2;

     

    and replace the glTexImage2D call with

    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, testWidth, testWidth, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

     

     

    Using 33191 and GL_DEPTH_COMPONENT as parameters, my max texture size is 8192, then my max shadomapsize is 4096.

    I tried this with a simple program with a rotating cube and it's ok, works with 4096 and not with 8192 :-)

     

    But if I load a big quantity of models the 4096 doesn't works anymore, I think as you say because then there's not enough memory to allocate both models and texture... but at least there's a way to detect max shadowmap size because of max texture size...

     

    Thanks lumooja

  13. Maximum shadowmap size is the same as maximum texture size, and you can get it this way:

    http://www.opengl.org/resources/faq/technical/texture.htm#text0120

     

     

    yes glTexImage2D is the funcion I said to use, but what format is using Leadwerks to pass the right parameters to the function?

     

    I tried with this code:

     

    GLint testWidth = 256;

    GLint resWidth;

     

    while( true )

    {

    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8, testWidth, testWidth, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

    glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &resWidth);

     

    if (resWidth == 0 )

    {

    resWidth = testWidth / 2;

    break;

    }

    else

    {

    testWidth *=2;

    }

    }

     

    and I obtained than my maximum texture size is 16384

    but Leadwerks engine hungs when I select a shadowmapsize of 4096 or higher... I think is because I didn't pass the right parameters...

  14. Is posible to disable shadows of an individual light? But not globally (with SetShadowQuality I can disable shadows globally but not in an individual light). I want to have lights that produce shadows, but want also some lights to add illumination without produce shadows. Is this posible?

     

    Thanks

  15. Hello:

     

    I'm starting doing my own shaders, and after reading some book, I see something different in Leadwerks shaders.

     

    Usually (in book)

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

     

    but in Leadwerks mesh.vert shader:

    gl_Position = gl_ModelViewProjectionMatrix * mat * gl_Vertex;

     

    Also normals are transformed with nmat matrix...

     

    Why is necesary multiply positions by mat and normals by nmat?

     

    Thanks

  16. Try updating your graphics drivers. The engine will run on your card, though it will be pretty slow.

     

    I updated the drivers, the train demo runs at 4 FPS :-(, but I see strange shadow artifacts that appear randomly ... I did a simple program with a light and 2 simple models and also see extrange shadows.... and all works really slow

×
×
  • Create New...