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

Author Topic: Shading problems with VertexColors  (Read 2542 times)

0 Members and 1 Guest are viewing this topic.

stulleman

  • Newbie
  • *
  • Posts: 12
    • View Profile
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!
« Last Edit: February 17, 2015, 02:14:34 pm by stulleman »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: Shading problems with VertexColors
« Reply #1 on: February 17, 2015, 02:17:21 pm »
I've no idea what you're talking about. What is the issue? What result do you expect?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

stulleman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Shading problems with VertexColors
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Shading problems with VertexColors
« Reply #3 on: February 17, 2015, 02:30:56 pm »
Quote
Every light fades wrong on the left side (Image: Number 1 and 2). You can clearly see spikes on the edge.
Maybe it's just me, but I can't see those spikes or anything else that would be wrong. Your screenshot looks good to me ???
Laurent Gomila - SFML developer

stulleman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Shading problems with VertexColors
« Reply #4 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!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Shading problems with VertexColors
« Reply #5 on: February 17, 2015, 03:11:10 pm »
Quote
If you don't mind. Please download the picture and zoom in to (Image: Number 1).
That's what I did. The intensity & contrast of my monitor are low, that probably explains why I can't see what you're showing.
Laurent Gomila - SFML developer

stulleman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Shading problems with VertexColors
« Reply #6 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Shading problems with VertexColors
« Reply #7 on: February 17, 2015, 05:20:47 pm »
Yeah I couldn't see it on my phone either, but see it on the PC.
Though I wonder how much of an issue it would really be, I mean you have to look rather closely and if you play a game, you usually wouldn't...

The simplest way to make some "lighting" is just to use a texture, alpha blend it on an nearly black, slightly transparent full screen/window rectangle and render that to the scene.
That way you get a darker scene and where ever you applied the light texture it will be a lot brighter.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything