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

Author Topic: Multiple texture/sprite alpa splatting  (Read 3387 times)

0 Members and 1 Guest are viewing this topic.

Trigve

  • Newbie
  • *
  • Posts: 4
    • View Profile
Multiple texture/sprite alpa splatting
« on: December 23, 2014, 12:07:31 pm »
Hi,
I'm evaluating the SFML for my current project (2D isometric tile based game). In the engine I'm using now, I'm making the terrain as a flat mesh with textures attached and custom pixel/fragment shader. The terrain is practically the tile map. The terrain mesh is using 2 textures, one is for the actual terrain tiles (grass, mud, sand), another is the alpha texture for the splatting between the different terrain type (grass and mud for instance). Each vertex has defined 3 texture coordinates and I'm using them in the shader.
Looking through the documentation the stuff that is most similar to my terrain mesh is using the sf::Vertex to create the mesh. But sf::Vertex supports only 1 texture coordinate and I need at least 3.

Is there any other options to achieve what I want? Would it be possible to add more texture coordinates for sf::Vertex (and therefor multi-texturing support)?

Thank You
Trigve

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Multiple texture/sprite alpa splatting
« Reply #1 on: December 23, 2014, 12:19:12 pm »
Nop, this is not possible (yet?).
Laurent Gomila - SFML developer

Trigve

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Multiple texture/sprite alpa splatting
« Reply #2 on: December 23, 2014, 12:53:34 pm »
Thanks for the reply,
I was looking at the sources and it looks like it would be possible to add it. Or do you see some obstacles or caveats preventing it? Maybe I'll try it (as proof of concept).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Multiple texture/sprite alpa splatting
« Reply #3 on: December 23, 2014, 01:05:51 pm »
Indeed it should be straight-forward to add it. All it needs is two new pairs of Vector2f in sf::Vertex, and the corresponding OpenGL code in sf::RenderTarget::draw.

However, the fact that it is possible doesn't mean that we want to add it to SFML ;)
Laurent Gomila - SFML developer

Trigve

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Multiple texture/sprite alpa splatting
« Reply #4 on: December 23, 2014, 02:01:01 pm »
Indeed it should be straight-forward to add it. All it needs is two new pairs of Vector2f in sf::Vertex, and the corresponding OpenGL code in sf::RenderTarget::draw.
I see.

Quote
However, the fact that it is possible doesn't mean that we want to add it to SFML ;)
Are there any reasons for this?

Thank You

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Multiple texture/sprite alpa splatting
« Reply #5 on: December 23, 2014, 02:04:37 pm »
Quote
Are there any reasons for this?
You ask for 2 additional texture coordinates, fine. Then someone will ask for a normal vector, again 2 more texture coordinates, then a specular color component, ...

If SFML was full of "everything that is possible to implement" then it would certainly be a bloated and unusable library ;)

However it doesn't mean that it won't be implemented in some way, just that it requires further discussions, mostly about design considerations (since the implementation is trivial).
Laurent Gomila - SFML developer

Trigve

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Multiple texture/sprite alpa splatting
« Reply #6 on: December 23, 2014, 02:12:17 pm »
Of course. I didn't meant that if it is somehow implemented, that it should be included in a minute. Just was curious if you were dismissing the whole concept of multitexturing ;)

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Multiple texture/sprite alpa splatting
« Reply #7 on: December 23, 2014, 02:44:00 pm »
Maybe I'm missing something, but wouldn't it be possible (albeit slightly less efficient than raw OpenGL) to do this simply by making your sf::VertexArray three times longer, rather than changing sf::Vertex to hold three pairs of texture coordinates?