Jump to content

havenphillip

Members
  • Posts

    550
  • Joined

  • Last visited

Posts posted by havenphillip

  1. Ok so you set the "col" to vec3(0,0,0) that's where the black is coming from. You're sort of just trying to add the effect over a black screen. The screencolor texture for post effect shaders is texture1. That gives you the standard screen.  Set it instead to:

     

    uniform sampler2D texture1; //color

    ...

    vec3 col = texture(texture1, q ).xyz;
     

    • Like 1
  2. I don't think there's an official tutorial or anything but I made a tutorial on how to convert from Shadertoy to Leadwerks. If you look around the community you can find things here and there.  Also I made a blog with a bunch of different shaders you can grab. Once you get the hang of them you should be able to figure them out.
     

     

    ...and the blog:

     

     

    • Like 3
  3. Dude that looks unbelievably good. I'm impressed with HOW MUCH stuff you got in the level. That foliage thing you came up with is awesome. I want to get in there and work on some of the textures and effects. The movement on the plants too. Love it all. How "done" is the level and is it updated to that point? I want to go through everything and fix the specular on the rocks, etc. Add that subsurface scattering to the plants, and is there a bed carved for a river?

    • Like 1
  4. You can cull backfaces in shaders. In your material shaders you can try adding this anywhere under the main. I haven't tested it to see what kind of FPS bump you'd get but maybe it'll help:

    if (!gl_FrontFacing) discard;

    • Upvote 1
  5. Oh I see what you're doing. You could use a single material to do it. The thing that makes emission is really simple it's just the first three vectors of the specular output.


    You could set up an if statement in the shader something like this:

     

    uniform float light_on;
    
    
    ....
    
    
    if (light_on == 1.0) {
    
    fragData2 = vec4(1,1,0,1);
    
    }
    
    else {
    
    fragData2 = vec4(0,0,0,specular);
    
    }

     

    Then in your script somewhere you set the float and set it to the flashlight function. Something like:

     

    Script.flashlightOn == 0.0
    
    
    ...
    
    self.shader:SetFloat("light_on",self.flashlightOn)
    
    
    function Script:UpdatePhysics()
    
    ...
    
        --Toggle the flash light on and off
        if window:KeyHit(Key.F) then
            if self.sound.flashlight~=nil then self.sound.flashlight:Play() end
            if self.flashlightOn == 0.0 then
                self.flashlightOn == 1.0
            else
                self.flashlightOn == 0.0
            end
        end

     

     

     

     

     

     

    • Like 2
    • Upvote 1
  6. There's a documentation page:

    https://www.leadwerks.com/learn?page=

    The community is pretty good but it can be a bit difficult if you're a total beginner but most people I've seen seem to pick it up pretty fast. I didn't code at all when I started but I discovered you can pretty much figure out how to do anything.

    Not entirely sure what you're saying but look up "HUD Elements" in the Workshop. Stuff I found in the community mostly. It's got lua and shaders working together.

    Your stuff looks cool. Looks like you already know what you're doing.

     

    • Like 2
  7. I'm super pumped about this decision but I still think you should keep the subscription option.

    Buying the standalone one-time payment, then buying all the DLC separately should be the "hard way" to do things. A subscription that was like 75% of the cost in one year of what it would cost to buy the standalone plus all the DLC  separately would appeal to a different kind of person (or whatever just so that subscription is the much better deal). I'll happily do things the "hard way" because that's just my own matrix of wants/needs but I think subscription could still work relative to the standalone option. It changes the payoffs. Instead of "paying rent" I'm "paying less so I don't have to pay more like those nerds over there."

    I don't know the industry but it seems like maybe the people you're selling the subscription to may be serious game developers who don't like the way Unreal essentially punishes people for being successful.

    I've seen your blog posts and all the work that went into it. I think your work speaks for itself, and Ultra does like 10X what Leadwerks 4 does and I bought Leadwerks for $100 like seven years ago. I'd gladly pay $150 - $200 for Ultra (I probably shouldn't say that but it's true. I mean some guy was willing to give you $700 for it).

     

    • Upvote 1
  8. I tried to reproduce it. I'm not getting the same outcome. It seems to be working correctly for me:

    teapot.thumb.jpg.04a8b498e2ed37a0ae7ffa9b73203f10.jpg


    When you zoom in and out on the object does it adjust itself? If it works correctly in-game then it might just be the material editor or have something to do with using the "player_pos".

    Otherwise sometimes I've noticed if I restart my computer it will fix some of these weird things.

    Does this work?:

     

     

    #version 400
    #define MAX_INSTANCES 256

    //Uniforms
    uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity;
    uniform mat4 projectioncameramatrix;
    uniform float currenttime;
    float time = currenttime/1000;
    uniform vec3 cameraposition;
    uniform vec3 player_pos;

    //Attributes
    in vec3 vertex_position;
    in vec2 vertex_texcoords0;
    in vec3 vertex_normal;
    in vec3 vertex_tangent;
    in vec3 vertex_binormal;

    //Outputs
    out vec4 ex_vertexposition;
    out vec2 ex_texcoords0;
    out vec3 ex_normal;
    out vec3 ex_tangent;
    out vec3 ex_binormal;

    void main()
    {
        //entity matrix
        mat4 entitymatrix = entity.matrix[gl_InstanceID];
        mat4 entitymatrix_ = entitymatrix;
        entitymatrix_[0][3]=0.0;
        entitymatrix_[1][3]=0.0;
        entitymatrix_[2][3]=0.0;
        entitymatrix_[3][3]=1.0;
        
        //model position
        ex_vertexposition = entitymatrix_ * vec4(vertex_position,1.0);

        //Interactive
        vec3 direction = normalize(ex_vertexposition.xyz - player_pos);
        direction.y = -0.000;
        float radius = 2.0;
        float interact_power = 2.0;

        float dist = distance(player_pos,ex_vertexposition.xyz);
        float power = smoothstep(radius,0.0,dist*dist*0.3);
        direction = (vec4(direction,1.0) * entitymatrix_).xyz;
        ex_vertexposition.xyz += direction * power * 5.0 * interact_power * cos(5.0-ex_texcoords0.y)*cos(5.5-ex_texcoords0.x);

        gl_Position = projectioncameramatrix * ex_vertexposition;

        //normals
        mat3 nmat = mat3(entitymatrix_);
        ex_normal = normalize(nmat * vertex_normal);    
        ex_tangent = normalize(nmat * vertex_tangent);
        ex_binormal = normalize(nmat * vertex_binormal);

        //texture coordinates
        ex_texcoords0 = vertex_texcoords0;
    }

     

     

  9. 7 minutes ago, Josh said:

    I am talking more about image processing. It can remove the lighting from some photographs and gives you a look that is closer to the true color of a surface. I think it is done by first applying a Guassian blur and then some other operation.

    Yeah it uses kernels to blur the image then subtracts the standard image from it which gives a grey, and the difference due to the blur sharpens it up. That's what high pass is in GIMP. I don't know how it would be used for lights. Looks like this:
    highpass.thumb.jpg.9a043791d7699dcdb9ed8c0ac74a6599.jpg

    • Like 1
  10. 28 minutes ago, reepblue said:

    Oh cool, so this makes it so the room isn't lit by multiple point lights?

    Also Phil, is that a post process shader that'll work in Leadwerks? I'm eager to try it out! 

    Yeah totally dude it's from muh blog.

    • Like 1
×
×
  • Create New...