Jump to content

Ma-Shell

Members
  • Posts

    371
  • Joined

  • Last visited

Posts posted by Ma-Shell

  1. What exactly is the problem?

    I can create a Material, activate Z-Sort and switch the Blend mode to Alpha and use the fragment shader you provided above (I also used the vertex shader from the standard diffuse shader and made it fit to the fragment shader.)

    With this I can get a material which is transparent.

  2. You can see, the shader uses fragData0, fragData1 and fragData2.

    So try adding

    fragData0.a = round(fragData0.a);
    fragData1.a = round(fragData1.a);
    fragData2.a = round(fragData2.a);
    

    in the end, just before the closing }

     

    @ScrotieFlapWack

    I don't know whether it is documented anywhere but I also only found the answer via googling, which led me to Rastar's Blog:

    http://www.leadwerks.com/werkspace/blog/117/entry-1167-up-part-2/

    And now I have to take a deeper breath: Leadwerks 3.1 is using a deferred renderer. This means that all lighting calculations are done behind the scenes in a separate processing step taking place after the fragment shader has run. So you won't see lighting calculations for diffuse reflection, specular reflection etc. here, but rather a filling-up of several buffers:
    • fragData0 contains the diffuse color (rgb) and transparency (alpha) of the fragment
    • fragData1 stores the normal (rgb) and specularity (alpha)
    • fragData2 holds the emissive color (rgb) and a flag for lighting on/off (alpha)
    • fragData3 - no idea if this is being used and what it might hold

     

    Edit:

    Also what you are editing is just the alpha value. The code I provided just says: If the alpha value is over 0.5 then set it to 1, else set it to 0.

  3. Well, I am not really getting why the above one doesn't work for you but you can just include a threshold in your fragment shader. Just add (after fragData0 was set):

    if(fragData0.a > 0.5)
    fragData0.a = 1;
    else
    fragData0.a = 0;
    

    You can also use a threshold other than 0.5.

     

    Edit:

    What would be even easier:

     

    fragData0.a = round(fragData0.a);
    

     

    and if the shader also set fragData1 etc. just add the lines for them as well.

  4. Thanks, got it working with your bloom.lua.

    In case anyone else is interested:

     

    //Render first image
    myBuffer->Enable();
    world->Render();
    myBuffer->Disable();
    context->Enable();
    context->SetShader(myShader);
    myBuffer->GetColorTexture()->Bind(1);
    myBuffer->GetDepthTexture()->Bind(2);
    context->DrawImage(myBuffer->GetColorTexture(),0,0);
    

     

    The shader will get those by

     

    uniform sampler2D texture1;
    uniform sampler2D texture2;
    

     

    Another question regarding this:

    The depth-texture will only use the red-channel. The green- and blue-channel will always be 0 and the alpha-channel will always be 1. Storing four values per pixel if actually only one is useful, seems to be kind of a waste of space. Especially on the GPU space is a valuable good.

    Is there anything I can do to help this?

    • Upvote 1
  5. Hi,

     

    is it possible to use the depthbuffer for postprocessing effects?

    I looked at all the existing postprocessing shaders and saw, all of them only use the color-texture, which is retrieved by

     

    uniform sampler2D texture1;
    

     

    I also found, that texture2 contains some kind of a cobblestone texture but all the other slots seem to be empty.

     

    Also I saw, it is possible to push a Vec4 Uniform to the shader by

     

    (C++):
    myShader->SetVec4("foo", Vec4(0,0, 1, 1));
    
    (GLSL):
    uniform vec4 foo;
    

     

    but I didn't find any way of pushing an arbitrary texture as a uniform.

  6. When I navigate to the Leadwerks.exe and make a shortcut I don't have a Web Document tab to place that data into. Win 8.1 here.

     

    Just rightclick on the desktop -> new -> shortcut -> enter "steam://rungameid/251810" -> give a name -> finish

     

    (the single points might be named slightly different since I translated them)

     

    EDIT:

    You can also just take the attached file. (The forum here doesn't allow for shortcuts (.lnk-files), so I had to zip it.)

    LE-shortcut.zip

  7. Hi,

    I noticed, when playing a sound via (C++):

    Sound* s = Sound::Load("Sound\\Footsteps\\jump.wav");
    s->Play();
    

    the RefCount of the Sound will be increased but not decreased after the sound is done playing.

    However, playing the sound via

    Entity* e = world->entities.front();
    e->EmitSound(s);
    

    will increase the RefCount but also decrease it, after it is done playing.

     

    This should be consistent, because this has consequences:

    When using Play(), I can instantly after playing the sound release it with

    s->Release();
    

    When using EmitSound() and doing the same, after the sound is done playing, I get into the DebugErrorHook with the message "OpenAL: AL_INVALID_OPERATION" and the game stops. I guess, this happens, because the latter method releases the sound after finishing playing it and thus the RefCount gets decreased and reaches 0, so that the sound gets deleted which is somehow a problem for OpenAL.

  8. - Exit LE-Editor

    - Copy mesh with only 1 vertex into model-folder of the project (see attachment)

    - Start LE-Editor

    - Switch to assets-tab

    - Scroll down

    => Access-Violation

     

    Just for justification of my sanity wink.png :

    Why would I want a mesh which consists only of one vertex?

    Answer: Geometry shader

     

    This needn't be on priority, since for clipping issues I had to take a box instead of one vertex but I guess, it can be fixed quickly.

     

    vertex.fbx

  9. The problem is that self.position is already a Vec3, so you just need to remove "Vec3"

    local pos = self.camera:Project(self.position)
    

     

    Also note, that your value of right.x will increase each frame, as in the first one it is:

    right.x = 1 ==> position.x + right.x = position.x + 1

    right.x = position.x + 1 ==> position.x + right.x = position.x + position.x + 1

    right.x = position.x + position.x + 1 ==> position.x + right.x = position.x + position.x + position.x + 1

    ...

  10. To me it looks like you are referencing a variable that doesn't exist yet:

    The line

    self.right = Vec3(self.position.x + self.right.x, self.position.y, self.position.z);
    

    uses the variable self.right.x, which isn't defined yet, I guess.

    Try using a constant there (something like

    self.right = Vec3(self.position.x + 100, self.position.y, self.position.z);

    ) and see, if it solves the issue.

  11. Sadly, there doesn't seem to be any official way for doing so.

    This has been discussed in

    http://www.leadwerks.com/werkspace/topic/9676-camera-layers/

    and

    http://www.leadwerks.com/werkspace/topic/9464-rendering-backgroundsforegrounds/

    where the latter one shows a work-around, but I would definitely be interested in an official statement from Josh to this, since in my opinion it was a great strength of LE2.5 that you could say something like:

    world1->Render();
    world2->Render();
    context->RenderLighting();
    

    And having the lighting calculated in screenspace only ONCE (not for both render-calls), since this is the way a deferred renderer works (http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf)

  12. Nice to hear, you solved it yourself.

     

    I guess, the cause of the problem has something to do with this:

    The editor now has the option to use a centimeter grid. The previous meter-based grid is still available in the viewport tab in the options dialog. This is important because it allows us to more easily line brush geometry up to textures. By default, a 1024x1024 texture will map to a 256x256 cm space, which is just a bit over 2.5 meters. This is important because a standard wall texture will now map to a more accurate size by default. You can also modify the mapping scale in the material properties. This will allow you to make a 512x512 texture map to a larger space, for example.

    (from http://www.leadwerks.com/werkspace/blog/1/entry-1226-new-build-provides-texture-lock-improved-tex-mapping/ )

  13. We've had this discussion. Zip packaging and reading is possible with Leadwerks (just not documented).

    The discussion, gamecreator is referring to, is http://www.leadwerks.com/werkspace/topic/8659-implement-virtual-filesystem/

     

    I second encryption, just to keep out copycats. But doesn't ZIP format support this by default? Password protection as I recall it. Don't know if it is good enough either.

    It will work for some script-kiddies but you can't do anything against a skilled hacker (at least I don't know of anything): He could just take all the files from RAM while the game is running.

  14. I was talking of high level functions instead included in some package like some you can find with Unity. Perhaps some solution will be available in LE3. Coop story games are very interesting allowing mutual help and interaction, they are becoming to appear lot more in incoming games.

     

    The problem about this is, that you can not really optimize stuff. There are different requirements for different tasks. For example with an FPS you have to make sure that some important things get through, like e.g. hits. On the other hand, it would be an overkill to really make sure that every position/rotation update is transferred. So you have to design your own protocol for this. If you just have a switch like "synchronize this object", you can't really differentiate between those, so you would either end up having too many losses or a flooded network.

    • Upvote 1
  15. Sockets/WinSockets FTW! wink.png

    Highly compatible to each other (as long as you don't use WSA-functions) and free.

     

    I think Steam just gives the social and room/lobby aspects and not the actual gameplay networking code.

    I think, I read somewhere (probably in this forum) that you can also send arbitrary messages to any steamid.

  16. LE3 doesn't use the shaders.pak any more. Instead there should be a "Shaders" folder somewhere (most likely on top-level) in your project folder. Each material uses only one shader (and one for shadows), which includes the vertex- AND the fragment-shader in a single .shader - file.

    As far as I understand, you have to annotate, where the vertex-shader starts using

    @OpenGL2.Vertex
    

    (Just use the minimum OpenGL-version, your shader is compatible to.)

    And your fragment-shader should start with

    @OpenGL2.Fragment
    

    (Don't know if this is sufficient. Just have a look at one of the example-shaders in that folder.)

     

    Then in the editor you create a material and assign the shader.

    (Compiling of the shader is done while loading)

  17. It is a native port, but they are there so you can just copy this to windows and launch the .exe.

    For Launching it: Navigate to the leadwerks-folder (the same as the .exe and .dll files are in) and run the install.sh (if you didn't already do so). This folder should also include a file called just "Leadwerks", which is the Linux-binary, you should run.

×
×
  • Create New...