Jump to content

reepblue

Developers
  • Posts

    2,510
  • Joined

  • Last visited

Posts posted by reepblue

  1. Bout time! I've went to the post to see what they've said, but I figure it was a PM/E-mail as nothing else was posted.

     

    I still like the idea of turning multi-sampling completely off personally, but I understand that this is getting real messy, real fast. However, you're already knee deep in this process...

  2. Hey all,

     

    I decided for fun to sync up the Vectronic Demo with the latest version. I also wanted to see how the game looked with multi sampling off. when I booted up the game however, it lacked fog. No big deal I thought, I'll just use the #if SAMPLES==0 statements like the light shaders do, and make ms textures 2d textures.

     

    I did just that, and it works.... Only if SAMPLES==0 and MSAA is set to 0 as well. I'm curious why there isn't an automatic system in the shader system to detect if MSAA is 0. (I thought #if SAMPLES==0 was it.)

     

    I've looked at the decals and they use an int that's most likely toggled under the hood. How would I do this with any Post Process effects that are loaded? In the PBR code, there was a way to toggle an int value, but could I just load the shader and toggle it, or do I need to fetch the active camera, get the shaders of the post processing effects, and do it that way?

     

    Perhaps a global sampling value would be nice here so other users don't collide with this issue while making/updating shaders. Maybe actually Set SAMPLES to 0 when Multisampling is 0? This might be more of a request more than anything.

     

    Thanks.

     

    Oh, for those who want the semi-fix, here:

     

    _passthrough.shader (Frag)

    #version 400

    #ifndef SAMPLES

    #define SAMPLES 1

    #endif

     

    uniform bool isbackbuffer;

    uniform vec2 buffersize;

    uniform vec2 camerarange;

    uniform float currenttime;

     

    out vec4 fragData0;

     

    uniform sampler2D texture1;

     

    #if SAMPLES==0

    uniform sampler2DMS texture2;

    uniform sampler2DMS texture3;

    #else

    uniform sampler2D texture2;

    uniform sampler2D texture3;

    #endif

     

    void main()

    {

    vec2 icoord = vec2(gl_FragCoord.xy/buffersize);

    if (isbackbuffer) icoord.y = 1.0 - icoord.y;

    vec4 color = texture(texture1,icoord);

    fragData0=color;

    }

     

    _klepto_fog.shader (Frag)

    #version 400

    #ifndef SAMPLES

    #define SAMPLES 1

    #endif

     

    uniform sampler2D texture1;

    uniform samplerCube texture2;

     

    #if SAMPLES==0

    uniform sampler2D texture3;

    #else

    uniform sampler2DMS texture3;

    #endif

     

    uniform bool isbackbuffer;

    uniform vec2 buffersize;

    out vec4 fragData0;

    uniform samplerCube uTexture;

    smooth in vec3 eyeDirection;

    uniform vec2 camerarange;

    uniform float camerazoom;

    uniform vec3 cameraposition;

    uniform mat4 camerainversematrix;

    uniform mat4 projectionmatrix;

    uniform mat4 cameramatrix;

     

    uniform vec2 fogrange = vec2(0.0,15.0);

    uniform vec4 fogcolor = vec4(0.72,0.73,0.67,1.0);

    uniform vec2 fogangle = vec2(5.0,15.0);

    uniform bool fogislocal = false;

    uniform float clipheight= 0.0;

     

     

    float DepthToZPosition(in float depth) {

    return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y;

    }

     

    void main() {

    //integer screen coordinates

    //needed for depth lookup

    ivec2 icoord = ivec2(gl_FragCoord.xy);

    if (isbackbuffer) icoord.y = int(buffersize.y) - icoord.y;

     

    //floating screencoords normalised to range 0-1

    vec2 coord = vec2(gl_FragCoord.xy/buffersize);

    if (isbackbuffer) coord.y = 1.0 - coord.y;

     

    //fetch depth value

    float depth;

     

    #if SAMPLES==0

    depth = texelFetch(texture3,icoord,0).x;

    #else

    depth = texelFetch(texture3,icoord,0).x;

    #endif

     

    //calculating worldposition from cameramatrix,screenposition and depth

    //normalize it to get the cubecoords

    vec3 screencoord;

    screencoord = vec3(((coord.x)-0.5) * 2.0,((coord.y)-0.5) * 2.0 / (buffersize.x/buffersize.y),DepthToZPosition( depth ));

    screencoord.x *= screencoord.z;

    screencoord.y *= -screencoord.z;

    vec4 worldpostemp= vec4(screencoord,1.0) * camerainversematrix;

    vec3 worldpos = worldpostemp.xyz;// / 1.0-worldpostemp.w;

    worldpos+=cameraposition;

    vec3 cubecoord = normalize(worldpos.xyz);

     

    fragData0 = texture(texture1,coord);

     

    if(depth == 1.0) //no geometry rendered --> background

    {

    vec3 normal=normalize(cubecoord);

    normal.y=max(normal.y,0.0);

    float angle=asin(normal.y)*57.2957795-fogangle.x;

    float fogeffect=1.0-clamp(angle/(fogangle.y-fogangle.x),0.0,1.0);

    fogeffect *= fogcolor.w;

    fragData0=fragData0*(1.0-fogeffect)+fogeffect*fogcolor;

    }

    else // no background - render input + fog to output

    {

    float lineardepth = DepthToZPosition(depth);

    float fogeffect = clamp( 1.0 - (fogrange.y - lineardepth) / (fogrange.y - fogrange.x) , 0.0, 1.0 );

    if (fogislocal && lineardepth > fogrange.y) fogeffect=0.0;

    fragData0 = fragData0 * (1.0 - fogeffect) + fogcolor * fogeffect;

    }

    //if (cameramatrix[3][1] <= -0.99) fragData0=texture(texture1, icoord);

    }

  3. I understand that the MSAA 0 support is in beta (and released today), but I thought I might aswell post this report as soon as possible while it's still recent.

     

    I was testing my Darkness Awaits template for the Github transfer, and I decided to test multisampling set to 0 to see what would happen, and this was the results.

     

    msaa0_1.png

     

    msaa0_2.png

     

    As you can see, the particles aren't drawing correctly when multisampling is set to 0.

     

    You can see for yourself by installing this template, Set "multisample" to "0" in the player script, and playing the start map. Walk around and watch the flames toggle on and off depending on distance.

  4. It's not like there is anything in Leadwerks that controls VSync. It's just a single setting set with a Windows call.

     

    Ahh ok, then it's the whole "My GPU hates Vsync" reasoning when I noticed why my frames were dipping.

     

    Nevermind, was due to some GPU settings. Fixed.

     

    Mind sharing what you did? Because Leadwerks isn't the only engine I notice Vsync issues.

  5. However I noticed that even in release mode when I have vsync on water and AI drop my FPS back down to around 40. So maybe it's a problem with VSync and Leadwerks?

     

    I've been having issues with Vsync as of lately. Strangely when I load a map, it'll run at 60fps with vsync. Then when I reload it, the framerate tanks to 20, until you change the vsync setting to off, then on again, and it'll run at 60 again.

     

    Maybe I should upload the project so Josh can take a look at it as I would really like vsync to work as expected, and not turn the game into a slide show.

    • Upvote 1
  6. Nothing should hit the player if SetPickInfo is 0. but I can see in cases where you want things to shoot at you.

     

    Yeah, the way you'd go around this is make a collision type that hits everything but the player, and have your pick function use that.

  7. Hi,

     

    I've been wondering this for a while; is it possible to change the AppDataPath for your game using the professional edition? I commented out where it makes the default settings cfg, but it dumps the log under AppData/Leadwerks by default.

     

    I'm asking if there is a way to set it so the log file dumps within the root game folder, or maybe move the entire DataPath to the user's Documents folder, much like the editor does now.

     

    Thanks in advance.

  8. You can argue that the game is under fair use due to the entire project being a parody.

     

    I'm no lawyer, but if you really want to go forward, I'd look into the loop holes within the copyright system. You might still get clams, but if you've done your homework, you should be fine,

  9. Something I don't like about the template structure is that there is no skeleton template (That has nothing but the cpps/h/projects, the dlls, and shaders. I mean, you can hand make projects, but you'll be pressing "No" alot when it asks to update your project. the template tree should be skeleton -> common -> (Template).

     

    If you package your game, no one will be able to edit the lua files, as they'll be encrypted. But I'm gonna say this now, it's a lot easier to code your game objects in lua than C++. I only really recommend doing your application handling (window, context, map loading, etc) in C++. But that's just how I use the engine, everyone uses it differently it seems.

  10. Here is my code snippet. What value(s) would be best as each brush can have different dimentions. How would I go and say "If this face is bigger than 96cm x 96cm, then allow placement." ?

     

    if pickinfo.surface~=nil then
    
     --Print out the surface AABB
     local v1 = pickinfo.surface:GetAABB()
     --local v2 = c:GetAABB(Entity.LocalAABB)
     v1:Update()
     --v2:Update()
     System:Print("Surface ")
     System:Print(v1)
     --System:Print("Cyclone ")
     --System:Print(v2)
     if v1.min.y > 1 then
      System:Print("!!!SUCESSFUL PLACEMENT!!!")
      c = tolua.cast(c,"Model")
      c:SetPosition(pickinfo.position)
      c:SetParent(pickinfo.entity)
      c:AlignToVector(pickinfo.normal)
      c:SetScript("Scripts/Objects/Cyclone/Cyclone.lua",false)
      c.script:SetPushDir(pickinfo.normal.x,pickinfo.normal.y,pickinfo.normal.z)
      c.script:SetStartOpen()
      c.script:Start()
      self.LastCyclone = c
     end
    end
    

×
×
  • Create New...