Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - stulleman

Pages: [1]
1
General / Shading problems with VertexColors
« on: February 17, 2015, 02:12:19 pm »
Hello Forum!

Like you can see in the attachment I have a little problem with how my VertexColors are drawn (1,2).
It should be drawn like the green light on the right side (3).
I think I know what the problem is, but I don't have a solution for it. I am building my mesh like you can see in (4). Therefore you would have to rotate the Quads on the left side so it could smoothly fade the colors.
Do you guys know any fix for that?

Thanks!

2
General / Day/Night Cycle with shaders
« on: February 15, 2015, 09:49:11 pm »
Hello Forum!

I'm not sure if my question fits in here but I give it a try anyway, since I don't know any other forum where I could ask this. If you know any better forum for this specific question, please let me know.

I have my basic light propagation done so now I wanted to move on to day/night Cycles. Here (https://www.seedofandromeda.com/blogs/29-fast-flood-fill-lighting-in-a-blocky-voxel-game-pt-1) and here (https://www.seedofandromeda.com/blogs/30-fast-flood-fill-lighting-in-a-blocky-voxel-game-pt-2) I've got the idea for my solution.

I'm using the upper four bits (XXXX0000) of the Color class for my sun value (0-15) and the lower four bits for the torch value of each vertex.

I think this is the only way to pass arguments for each vertex to a shader, is it? (Vertex Attributes aren't supported by SFML?)

So because of this I'm storing both values (sun + torch) in the color attribute of a vertex.
I think my problem now is that a the vertex shader uses color values from 0-1 for r,g,b.
So I can't extract the values for sun and torches anymore. Is that right?

I'm just getting a black screen with this:

uniform float sunIntensity;

uniform float sunIntensity;

void main() {

        gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
        gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
       
        int torchLight = (int)gl_Color.x & 0xF;
        int sunLight = ((int)gl_Color.x >> 4) & 0xF;
        gl_FrontColor = vec4(torchLight, torchLight, torchLight, 1.0) + vec4(sunLight, sunLight, sunLight, 1.0) * sunIntensity;

3
General / Terrain Layers
« on: January 27, 2015, 05:55:56 pm »
Hello!

I'm building a little game (Top Down) with procedural terrain generation. (I'm coming from Unity and c# so I'm learning c++ and sfml while reproducing projects from the past  ;). And of course I learned c++ with other tutorials)

So my design looks like this:

I have a World class, that stores all my Chunks. My World is drawable, and my chunks as well. So i simply have to call window->draw(*world) to draw my world.
My chunks have VertexArrays to store the mesh.

My problem is when it comes to terrain layers. I want some things like vegetation to be drawn over the ground layer. Since we are in 2d I can only overdraw what is already on the screen, right? But wouldn't that mean I would double or triple drawcalls?

Is there maybe another approach for terrain layers?

Thanks in advance!

Pages: [1]