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

Author Topic: Dealing with large textures  (Read 3039 times)

0 Members and 5 Guests are viewing this topic.

gws923

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Dealing with large textures
« on: December 07, 2016, 09:22:32 pm »
Hi folks.

So, I recently began plugging in some textures into my biggest level yet.  I have about 20k by 20k pixels worth of graphics to get in there.

I've split the large image into about 20 4kx4k textures.  I can add about 10 of them and my level editor works no problem.  As I approach 15, my graphics card starts bugging out and I hit the Windows TDR limit (https://msdn.microsoft.com/en-us/library/windows/hardware/ff570087(v=vs.85).aspx).

I've increased my TDR limit, but I'm still hitting it, and I also feel that it doesn't really solve the issue which seems to be: I am asking too much of my GPU.

The files altogether are only 12 MB.  I have about 35 MB worth of graphics in another level and it runs smooth as butter, both in my level editor and in game.  The texture sizes are smaller, and I know(?) SFML only draws what's on screen, so it might be that with these large texture sizes SFML has to draw the whole thing when only a little bit might actually be on screen.  That's my best guess so far.

Does anyone have any recommendations for how to proceed?

EDIT: Further thought: If I should just use smaller textures, does anyone know of a good automated way to split a large picture into several small ones?
« Last Edit: December 07, 2016, 09:37:15 pm by gws923 »

B026

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Dealing with large textures
« Reply #1 on: December 07, 2016, 11:02:27 pm »
I'm not an expert but I got the same error when i was developing a game for android and I solved my problem using a smaller texture and repeat it.

There are several techniques to solve your problem, but they depend on it. Games like zelda or mario usually use tile maps. Here you have an excellent SFML example ;) http://www.sfml-dev.org/tutorials/2.4/graphics-vertex-array.php

gws923

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Dealing with large textures
« Reply #2 on: December 09, 2016, 12:20:51 am »
I'm not an expert but I got the same error when i was developing a game for android and I solved my problem using a smaller texture and repeat it.

There are several techniques to solve your problem, but they depend on it. Games like zelda or mario usually use tile maps. Here you have an excellent SFML example ;) http://www.sfml-dev.org/tutorials/2.4/graphics-vertex-array.php

I will definitely check out vertex arrays.  The problem is I can't repeat any textures because they're all unique.  I'm going to try breaking the image up into many smaller textures.  Means a lot of pain in the ass work, but it'll be worth it if it works (if anyone knows it won't work feel free to let me know and save me a lot of effort...!)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11006
    • View Profile
    • development blog
    • Email
Dealing with large textures
« Reply #3 on: December 09, 2016, 08:22:59 am »
Without any specific details all we can help you is with random guesses. ;)

What's your PC specs? What's your GPU and GPU driver version?
Can you create a minimal but complete example code that reproduces the issue?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gws923

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Dealing with large textures
« Reply #4 on: December 09, 2016, 07:42:57 pm »
Without any specific details all we can help you is with random guesses. ;)

What's your PC specs? What's your GPU and GPU driver version?
Can you create a minimal but complete example code that reproduces the issue?

It's not really my code that is the problem, I was more wondering the best way to approach this logistically.  I can tell what the problem is, basically, I was just wondering if anyone had experience dealing with really large textures and how they dealt with them.

I'm pretty sure if I just ask SFML only to draw the textures that are on screen (probably something I should have figured out long ago), it will solve my problem.