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.


Messages - stulleman

Pages: [1]
1
General / Re: Shading problems with VertexColors
« on: February 17, 2015, 03:21:02 pm »
So this is what I see (Attachment)

This http://www.alkemi-games.com/a-game-of-tricks-ii-vertex-color/ article describes what my problem is. Since this doesn't seem to be a common question, I don't think there is a good solution for it.

Does anyone have an idea how I could do my lighting in any other way than vertex Colors?

2
General / Re: Shading problems with VertexColors
« on: February 17, 2015, 02:36:42 pm »
Could it be because of the brightness of your monitor?
If you don't mind. Please download the picture and zoom in to (Image: Number 1). The green is more obvious than the red one.
I'm really astonished that it isn't that obvious on your side.

Edit: Wrong reference sorry!

3
General / Re: Shading problems with VertexColors
« on: February 17, 2015, 02:26:21 pm »
Okay I try t clarify my question.

I am building a basic light engine for my 2d-Topdown game. What you can see in the image is an empty level (white background tiles & it is night). I then added two lights. One red light on the left and one green light on the right. You can see that light propagation and mixing is working.
Like I said in my first post there are shading issues. In the image I've drawn numbers for reference.
What I expect:
That every side of the light fades out in the same way. And that is like the green light on the right side (Image: Number 3).
What is wrong:
 Every light fades wrong on the left side (Image: Number 1 and 2). You can clearly see spikes on the edge.

My assumption is that it is because of the way the triangles are aligned (Image: Number 4).

Please tell me if something still is unclear.

4
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!

5
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;

6
SFML projects / Re: Let There Be Light 2
« on: January 30, 2015, 08:42:20 pm »
Hey just out of curiosity, do know when you will release something we can experiment with?

7
General / Re: Terrain Layers
« on: January 29, 2015, 07:06:24 pm »
I've had performance issues already without chunking.
With Chunks of 16x16 and a map of 60x60 chunks (to get roughly 100km2) it is inevitable to chunk my terrain.
I have a working chunking system but (because of the reason of this thread) I need to modify this system.
The best solution that fits my needs would be from hapax.
I'll have something like a view class that holds n vertex arrays for each layer and chunks modifying this array.
I hope to get some results soon to share my experiences.

8
General / Re: Terrain Layers
« on: January 28, 2015, 11:43:03 pm »
Yes I'm totally okay with one draw call per layer.
But I'm not sure how I would organize my terrain without chunks like Ztormi suggested?

I'll explain what I have planned:

I have a big array in my world class where the current loaded terrain data (1 byte for each type) is stored.
I have planned to let it be as big as the player can see + a margin for not loading from disk all the time.

Now I have chunks, that know their position and where to get their information from the world class array. So whenever I want to edit the terrain I'll simply have to edit the array and tell the chunk that is responsible for this area to update it's vertex array.

If I understand you right Ztormi, you would suggest a vertex array that covers the whole area the player can see? But if I move to one side, this would mean a rebuild of the whole array. Or did you have something else in mind?

Thanks for the suggestions and help so far!

9
General / Re: Terrain Layers
« on: January 28, 2015, 12:19:33 am »
I will consider both. I will not try to over optimize it.
But the idea of just one draw call for the whole terrain sounds good. I just don't know how I would do it. Since I separated the chunks for a reason, and this is that it is fast to update them.
Do you have any ideas how this could be done?

10
General / Re: Terrain Layers
« on: January 27, 2015, 10:25:53 pm »
Oh okay!

I don't share a vertex array. My world instantiates many chunks and each chunk has it's own 16x16 vertex array.
That's something I used to do in Unity and I simply adapted it thinking it's the best method, isn't it?
Because of that I'm worried of draw calls. Because if you have 10 x 10 chunks you have 10x10 draw calls right?
It's not 1 draw call for the world.

11
General / Re: Terrain Layers
« on: January 27, 2015, 09:39:24 pm »
Ah I see. I'm not ready to test it because it's a lot more work in c++ compared to Unity ;)
But therefore you get more flexibility. I'll get there and if I have problems I'll come back :P
Thank you!

12
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]
anything