Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [WIP] Texture Splatting Shader (texture bleeding problem)

Author
Message
janbo
10
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Aug 2018 15:48 Edited at: 13th Aug 2018 16:01
Quote: "We have to keep in mind, that not everyone is able to create such altas in an image design software"

Haha you are right, but I would never think of using a third party tool for those things, as I'm not to good at it, I always generate things myself or use my own tools.
I should have posted a link to a tutorial or post some demo code as I do most of the time
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 13th Aug 2018 16:14 Edited at: 13th Aug 2018 16:18
OK so I just got around the testing this, getting around 2200 FPS on my system, but that's a GTX 1080.

I also get between 57 and 61 FPS on my S8+, but that could be a device limit.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 13th Aug 2018 16:33
OK, so a quick change for me adds a fair bit of speed = your mixing the color value all the time, even when there's no alpha channel to cause a mix, which is wasted calcualtions. Adding an if check adds about 10fps when rendering 45 planes for me on mobile.

Jack
14
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 13th Aug 2018 17:18 Edited at: 13th Aug 2018 19:04
Oh nice! - good point santman!

Thank you for the tutorial janbo! Combined with Van's code it will help to implement it to the shader

I could push the fps on my S3 from 11fps to 12.6fps, sometimes to 13fps. I think it will go even further if we create some sort of texture baking model.


I will attach the current project. I removed the clamp function in order to move to the "extra-space atlas method" that can provide mipmapping.
Right now, I work in "floor_effective.ps" it's basically the same, but with less variables and some sort of not working bool idea to render the static layer only once

I decided to create the shader in AppGameKit code, once we got the speed that we need, so there is no use for dynamic variables in ps files anymore. As long as we stay with the current atlas sizes during development, it will not have a negative impact.

Getting rid of most variables gave me also a boost from 8fps to 11fps,
so lets work in floor_effective.psfor a while. The next idea is, that
.. for(int p=2;p<maxtiles;p++){...

maxtiles should be replaced with the real amout of images that are used and not every possible image in the atlas. This will also give a huge boost, if we only want to use 8 textures instead of 16

I also work on the problem with the missing textures 4 8 and 12 (16 Wont be used at all, because we only have 15 splat textures):
Also texture "15" is wrong. It should be brown but uses texture 12 to map... :S

The problem is, that the first texture is used as a base and the second texture is actually the first splat texture in the atlas. It kinda blows my method right now, but I really want to have "texel[i=3]" - alpha value as an own layer, like in the shopped digit image above, because right now we miss about 25% of the possible alpha atlas images


BTW:
I saw some PBR shaders here for AGK.. do you think we can combine terrain and PBR in order to create something like this?:

As I see, there are plenty of free Terrain PBR textures

[/url]

Attachments

Login to view attachments
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 14th Aug 2018 01:20
FYI,

Iphone 8+ gets 60 FPS
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 14:17
Ok, so getting really close - got the blend mixing from teh alpha working fine, all looking good - and running at 2,800 fps on the PC, still hitting 60fps on my mobile when using 45 instances of the plane.

Just need to work on getting the mipmapping sorted and some issues with transparency and it's running fast for me.

Attachments

Login to view attachments
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 14th Aug 2018 14:36
Added this to the shader.


And this to AppGameKit main.


Gets me 35 FPS on my 100 dollar phone. I am thinking maybe replace discard with a baked texture would still keep cheap mobile phones fps respectable?
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 16:06 Edited at: 14th Aug 2018 16:09
So it's not perfect but this does the job and still runs at 60fps+ on my mobile while rendering 45 instances of the ground, around 700 FPS on the PC (still over 2000 when a single landscape).

Seams aren't perfect, but if you keep the camera away they look ok. Or you could pad the textures and make it flawless.

EDIT: just for the crack I ran 95 instances of the ground, and the mobile still gets 52 fps (S8+).

Attachments

Login to view attachments
Icerion
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 14th Aug 2018 17:43 Edited at: 14th Aug 2018 17:47
@Santman : How exactly do you fix the seams? Is there an easy way to do it?

Thanks!
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 18:01
The best way as Janbo says is to pad the textures, this just uses a hack to trim the edges. The alpha using the different play maps is making it difficult to line all the edges though.

What fps are you getting?
Icerion
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 14th Aug 2018 18:29 Edited at: 14th Aug 2018 18:32
@Slackman : what do you mean by "pad the textures"? How would I "pad textures"? I do not understand.

I'm getting 200.0+/- FPS.

Thanks!
Jack
14
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 14th Aug 2018 18:45 Edited at: 14th Aug 2018 18:46
He means, if we got a texture of 128x128 inside the atlas, the real texture should be
120x120 and a 8 pixel border around the image based on the nearest pixel color.
This wont cut out any pixels of use and the border dissapears.

Because borderless mipmapped terrain is a must have here

I just have some work to do right now, I return later that evening to the terrain shader development

[/url]
Icerion
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 14th Aug 2018 18:47
@jack : What type of border would I need to create? How would I do this say in paint.net for instance?

Thanks!
Jack
14
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 14th Aug 2018 18:53
janbo, vanB and me are trying to create a code-based algorythm for that. You just need to paste your textures somewhere with no additional work.

[/url]
puzzler2018
User Banned
Posted: 14th Aug 2018 19:07 Edited at: 14th Aug 2018 19:07
Just off topic and reason why we need to stay with 3D is



and



Skip to about 2min 30secs on this one

Keep up the good 3D work
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 14th Aug 2018 19:08
Wow. Nice. I am getting 60 FPS on my crap phone.
Icerion
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 14th Aug 2018 19:33
@jack : Can you make a small tutorial on how to do it? I've been trying & no results.

Thanks!
puzzler2018
User Banned
Posted: 14th Aug 2018 19:50
Icerion

Use GIMP or Paint or such thing like that

1stly Whats the size of your texture - if say its 480x480 texture, then

- Load paint

- Create a new canvas 512x512 - cause that the next power of 2

- Copy and paste the 480x480 texture into it that new canvas and place it in the dead centre of the 512x512 canvas - so you got a black border all way around.

- Save and use

I Hope thats correct
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 20:18
I have an algorithm that uses memblocks to load an image and copy the rows to pad it, when I get a chance I'll dig it out and fire it up
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 21:17
Puzzler, it's a dream but AppGameKit couldn't deliver those kinds of graphics. Not only is the gl version quite old, but the behind the scenes optimizations in things like drawing order and sorting etc will be immeasurable.

Not to mention I doubt any of us have a spare $30 million dollars and teams of artists and coders to throw at it. Lol.

Though I have pre ordered red dead.....cannot wait.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 21:22
Oh by the way, after thought.....make the atlas texture image 4 times larger, then remove the scaling multiplier......no more seam issues, though might slow down on older hardware.

Or, as I've found, make it much smaller, then increase the tiling to about 30.....the seams should all but vanish.
puzzler2018
User Banned
Posted: 14th Aug 2018 21:24 Edited at: 14th Aug 2018 21:32
Yeah - these games uses self manipulated skyboxes for the outer lands - just pngs that outline the world.


all they work in is a massiive skybox cube macarriously as that may seem

Cause this is a really complex art, thats why they need to go into the millions to use engines that does it all for them- but thats all it needs

Get around mastering a 3D cube skybox which you live in. and manipulate the surrounding planes images (not the plane your standing on cause this could be useful to have more closer effects) but the surrounding
planes that make that cube skybox -


We all know how to add pixels to an image and save them for the game to reload the image onto the skybox planes
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 21:47
Actually, ill all but guarantee theres no sky box. Even horrizon uses 100% shader code for its skys......and my own clouds have no images, the clouds are generated. I added rain now, so they darken and go grey.....still no images.

What I mean is the proper engine stuff.....like the order objects are sent to the gpu....agk does that for us, but the RGAE engine for example will be a super optimised draw call system. Built in imposters etc as well, and of course some amazing shaders.
Icerion
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 14th Aug 2018 22:18
@Santman : I would love to use that algorithm if at all possible! This is a wonderful idea!

Thanks!
puzzler2018
User Banned
Posted: 14th Aug 2018 23:31 Edited at: 14th Aug 2018 23:32
Am I dead or something?? isnt my suggestions worth while - cause i will leave


or is it that you just want code and not learn for yourself
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 14th Aug 2018 23:34
Eh?????
puzzler2018
User Banned
Posted: 14th Aug 2018 23:35 Edited at: 14th Aug 2018 23:36
Give this chap your full source code and make him happy - will never learn

he persistantly asking for source code to build his own.
puzzler2018
User Banned
Posted: 14th Aug 2018 23:48
We have worked our socks off to get what we acheive, to then find some newbie keep pestering for code and how to do and that and then been ignored when we try to help - but my help is just not good enough - (read back)

he just wants your source code to the full then mithering little hum bug who doesnt know really what to do

Rather upsetting
encode_decode
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 15th Aug 2018 03:01
@puzzler2018 - don't you think you are taking things a little too serious - the way I read it, questions were being asked and the last time I checked questions never hurt anyone. If people can do things to save themselves a little time what harm is that and if the code or whatever is not available then I am sure that will be made clear enough then we move on to something else. I just don't see the harm done.

Peace
puzzler2018
User Banned
Posted: 15th Aug 2018 08:26
Your absolutely correct, sorry @Jack for upsetting thread.

Ill just stick to working hard on Minecraft and let you folks carry on as you all were.
Phaelax
DBPro Master
16
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Aug 2018 12:41
wow, ghost of tshushima looks very realistic.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 15th Aug 2018 13:09
I agree with both.....I'm more than happy to help out if I can.....I get plenty help from others here.....but at the same time.....it could be viewed as rude to just constantly ask people to upload their work for free. On multiple threads and you tube. I have indeed spent dozens of hours working on my code and shaders, learning from others and the net, so where as I am happy to help, I'm not working for the benefit of others. Lol. Actually, I code as a hobby.....I have s full time job and then some.

That said.....Jack are you happy that I amend and use my version in my project? Was wanting to do a paintable detail overlay and was wondering how is get past 3 texture limits......this seems fast and good, if it's still viable on top of my own shaders.
Jack
14
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 17th Aug 2018 20:06 Edited at: 17th Aug 2018 20:10
Sorry guys for my absence,
I am from a family of doctors and we got a crazy guy in our town who stabbed and killed another doctor and family friend.
Things running out of control here, so I have to idle for a while now, in order to get things going somehow again....

Quote: "That said.....Jack are you happy that I amend and use my version in my project?"

Yes, no problem, if you already like the current state of the concept. Please keep sharing ground breaking ideas with the community.

[/url]
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 1st Sep 2018 02:37 Edited at: 1st Sep 2018 02:51
I hate to bring this up again, but I am trying to adjust this to use GameGuru's bump and normal map shader. FYI, I have not included any GG code.

I was hoping to get some performance improvement from the original GameGuru shaders. I have a slight improvement from 13 to 17 on my old crappy phone, but I need to get the texture scale correct. I have 60 FPS on Apple 8+, but my sand textures is garbled for some reason.

I am having trouble setting the uv scale. My textures are being "stretched out" despite me setting the image stage to use a scale of 32. I also noticed in the original project we could not change the uvscale.



The shader uses this line to set the new uv coords( interesting that its using more memory ):



GG shader:



My failed attempt - you can see its working I just am not getting my uv scale correct

Attachments

Login to view attachments
Jack
14
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Sep 2018 10:44
Hi folks, I returned after some harsh weeks. Sorry for going personal in a thread.

SetObjectUVScale( terraingrd, 1, 34, 34 )
This seems wrong, we set the UV scale inside the shader now, not in AppGameKit anymore, but maybe there is also something else to do.
Stay at Scale 1x1.


Golelorn, can you post some sort of working project, I can work with?
I do also have the gameguru loader, if it will be easier for you...

[/url]
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 1st Sep 2018 12:47
I removed the GG code.

Zipir
9
Years of Service
User Offline
Joined: 11th Aug 2009
Location: Turkey
Posted: 1st Sep 2018 13:00
16 diferent texture in texture atlas for blending terrain shader... so is it possible to use (in texture atlas) 8 texture for terrain painting other 8 texture for normal map images?
Zipir
9
Years of Service
User Offline
Joined: 11th Aug 2009
Location: Turkey
Posted: 1st Sep 2018 13:05
like this
https://www.youtube.com/watch?v=fQ2qnOc2438
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 1st Sep 2018 13:12
Jack,

A little google searching, and I was able to figure it out. Thank you, sir.

Login to post a reply

Server time is: 2019-05-25 21:24:10
Your offset time is: 2019-05-25 21:24:10