octa... hecta... tile problems

For developmental things relating to the graphics of the game.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Essentially it works like this:
- Draw floor_a using alpha blending, and make the drawn texture a 100 times bigger in the x dimension.
- Draw floor_b using additive blend, and make the drawn texture a 100 times bigger in the y dimension.
ˌɑrməˈɡɛˌtrɑn
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

This was actually a lot simpler than my brain could recognize :oops: apologies to both of you :|

Ok thank you for making it very very easy for me Jonathan (it seems I'm worse than I thought right now), I sincerely appreciate your patience because it enabled me to make a tiled dual texture grid that is correct. I've been talking about rotation before and that was totally misguided because no rotation should be done (bah I kinda should have realized when my Gradient floor worked but oh well...). I'm sorry for confusing you with that Your_Mom.

Quick and dirty:
- first I made the tile I wanted as a 20x20 texture
- floor_a.png is stretched in the horizontal direction (relative to just seeing the texture itself in your image program) and floor_b.png is stretched in the vertical direction.
- from the 20x20 texture I enlarged it to 2000 pixels in the vertical direction (yes vertical, not a mistake) and saved as floor_a.png
- from the 20x20 texture I enlarged it to 2000 pixels in the horizontal direction (once again on purpose) and saved as floor_b.png.

Why does it work:
- now what you see as a result actually sort of only contains the information one would have in a 20x20 pixel image (well and the info from however your image program scaled the textures before you saved them) and a sort of blending between the pixels by the program (afaik mipmap does this but only to a certain degree).
- by making the height of floor_a.png (2000) the same as the end result of the program scaling floor_a horizontaly (2000) you get a square result.
- since floor_b.png is not rotated and you make the same square shape by making its texture width the same as the end result of the vertical scaling you get another identical square.
- floor_a.png and floor_b.png will be different in that floor_a.png will have more color information along its vertical axis and floor_b.png along its horizontal axis. There might be blending issues that distort colors somewhat in comparison to the original image used as a base for making the floor textures.

The screenshot below is taken with grid_size 1 because the textures are actually kinda low on color information the large size nonetheless. The floor rgb is all 0.5.
Attachments
Dual layered grid, the screenshot has been shrinked 50%
Dual layered grid, the screenshot has been shrinked 50%
User avatar
Your_mom
Match Winner
Posts: 653
Joined: Sun Jun 06, 2004 1:45 am

Post by Your_mom »

so

floor =W x H
floor_a = W x (H x 100)
Floor_b = (W x 100) x H

one problem is ummm its not working....

floor =176 x 146
floor_a = 176 x 14600
Floor_b = 17600 x 146

problem is its not working.
Last edited by Your_mom on Thu Mar 17, 2005 6:20 am, edited 1 time in total.
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Just posting this to show the next step you're/we're likely to have to figure out if hex gids are to work well in dual rendering: we need to get a feel of the blending etc. so we can change our colors wisely or perhaps use transparent areas in one of the pngs to enhance sharpness...

The screenshot below is of a 20x20 pixel red and white triangle pattern with the same settings as in the example above, now these are perfectly even alternating triangles in the original texture but as one can see the white color bleeds a lot into the red after dual rendering so be prepared to tweak your images a lot Your_Mom :D
Attachments
I hope this gets shown even though there's an ampersand in the name... foolish me
I hope this gets shown even though there's an ampersand in the name... foolish me
User avatar
Your_mom
Match Winner
Posts: 653
Joined: Sun Jun 06, 2004 1:45 am

Post by Your_mom »

ummm i guess i'll post the floor texture and hope n54 can sort it out bucause its not working for me, its a couple pixils different then the one i was rescaling but its the same thing trust me
Attachments
feel free to play with this i like grid size 2 on single texture
feel free to play with this i like grid size 2 on single texture
floor.png (1023 Bytes) Viewed 9305 times
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Your_mom wrote:problem is its not working.
Ok you've got to make a perfect square out of whatever you want (I know this is a complete drag in relation to hexagons, if you want to I'll share the calculations/sketch I've made so far for trying to figure it out). It's got to be square to be precise and easy to manipulate when making floor_a and floor_b.

Nevertheless you've got the rest right:
floor = w x h | 176 x 146 // ok by this I guess we mean the width and height of our original texture (I've kept your figures for examples even though they really need to be square), this will make:
floor_a = w x (h x 100) | 176 x 14600 // and:
floor_b = (w x 100) x h | 17600 x 146
just like you said :)

But since you didn't make the original image square it trows a spanner into the details somewhere (exactly why I'm not sure of) :oops:

Edit: Ok I'll give it a try but it's 06:25 here now so well umm don't expect it returned today lol :D

Edit: Quick update: that sure didn't work well for hexagons :? I resized your image to a square and did exactly the same as I did with the previous examples but it only became extremely elongated... bah! lol :oops: it's probably some blending issue I'll try to tinker more with it later because hex grids are nice

Edit @ 0736 lol:
out of curiosity I made a perfect octogonal pattern (I've realized a perfect hexagonal pattern within a square is impossible, ah well, but it will be close) using the reversed colours you used, the original tile was 96x96. I did all as worked with the two first tiles I made but I got the same result as with the hexagonal tile. I tried switching _a and _b just to chech but it still didn't work (although the patterns can be kinda nice when I switched _a and _b) the textures still stretch in a different manner than the original dual texture tiles. I think we might be overstepping some kind of threshold which makes the code behave differently so next thing to try for me is to make a 50% smaller version of this last octagonal attempt. Maybe now, maybe after I wake up with qwerty on my forehead ;)
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

just a bump since edits don't get flagged

Edit:
the octagonal gone wrong screenshot, at least it proves that nice diagonal lines are posssible (btw yes I have noticed there are a few more lines than intended in any case; it's an error in the original image tile I'll have to correct)
Attachments
Wrong but kinda neat
Wrong but kinda neat
Last edited by n54 on Thu Mar 17, 2005 8:16 am, edited 1 time in total.
User avatar
Your_mom
Match Winner
Posts: 653
Joined: Sun Jun 06, 2004 1:45 am

Post by Your_mom »

i appreciate the help n54. I too have been tinkering to no avail. any one else out there feel like trying to help figure this out?
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Ok I've tried it with a 50% reduced (48x48) initial texture which is corrected (truly octagonal) but the problem still persists. I'm going to work my way down to 20x20 initial and if that solves it I guess I was extremely fortunate to try those first ones at 20x20 :ghost:
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Done down to 20x20 now and no success so my main suspect is now the color white :D

Maybe those two tiles that worked were flukes or I've misunderstood what made them work, anyway it's soon 9 in the morning here and my peanut brain is out of oil so I'm logging out :D

(we're not giving up though but I really should be finishing some other stuff first lol)
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

About the blending (I'm talking about what happens to each pixel):
- First floor_a is drawn using the known alpha blending. The texture color is multiplied by its alpha, the old framebuffer contents are multiplied by 1-texture alpha, and the results are added and stored in the framebuffer.
- Then floor_b is drawn using additive blending. The texture color is multiplied by its alpha, but the old framebuffer contents are left alone, and they are added and stored in the framebuffer.
ˌɑrməˈɡɛˌtrɑn
User avatar
Your_mom
Match Winner
Posts: 653
Joined: Sun Jun 06, 2004 1:45 am

Post by Your_mom »

the gif that looks like a 5 year old made pretty much explains what i did in the last 5 minutes lol

i still dont understand what jonathan wants me to do with the alpha channels
Attachments
yeah i drew the words RAWR
yeah i drew the words RAWR
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

I've continued to experiment and the more I've done the more I'm convinced that we're lacking some part of understanding of how the stretch actually works, as an example I have the following screenshot, the original tile is a 100x100 square with a 1 pixel rim with color and a centered 4x4 square with color and the rest is 100% transparent, the floor_a and _b are multipllied by 100 in the direction that is not stretched.

Still it is obvious from the screenshot that the textures are still stretched which forms the middle weak stripes (same effect that you see in your last example) making more of a quilt pattern than anything else.

It might be that it's simply impossible to do anything about this.
Attachments
Look closely and you see what is done to the small middle square
Look closely and you see what is done to the small middle square
User avatar
Your_mom
Match Winner
Posts: 653
Joined: Sun Jun 06, 2004 1:45 am

Post by Your_mom »

i tried an X tile black x,white background tiled in single looks like diamonds or like the grids crooked(expected this) but in dual texture with proper stretching it looks like white floor and upon extrerm closeup an even brighter white square not x outline
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Yeah that would be because of the same "stretching/blending within the stretch" afaik.

I guess the one way to work around this is to make patterns where the blending either improves the design or at least doesn't toally obliterate it, so it becomes hard (or impossible) to take a specific texture you want and then make a dual version of it...

Well there's one thing we haven't tried yet: splitting the design into different parts, I'm going to try that next.
Post Reply