Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ivomarel

Pages: [1]
1
Support / Re: Round corners
« on: April 14, 2014, 11:59:58 pm »
Ok so I finally went with the solution of importing a quarter circular object from Cinema4D, which I used for the top left and top right corner. Then I simply changed the offset of the corner material based on the width of the object.

Code: [Select]
float textureWidth = middle.renderer.sharedMaterial.mainTexture.width;
float offsetX = -0.5f + (middle.localScale.x % textureWidth) / textureWidth;
corner.renderer.material.mainTextureOffset = new Vector2 (offsetX, -1);

Then wrote my own simple sliced sprite script and done. Still, a lot of work for just round corners haha

2
Support / Re: Round corners
« on: April 10, 2014, 03:34:06 am »
Thanks for the response.

The downside of creating a SlicedTiledSprite, will be that the corners still have a fixed texture and will therefore only connect properly if  the platform is exactly 1,2,3 etc. tiles wide. I'd love to come up with a solution that works around this.

3
Support / Round corners
« on: April 09, 2014, 11:04:30 pm »
Hi all,

I am trying to create a tiled sprite with round corners with a dynamic width. See image.

The challenge here is the fact that the tiling goes on until the corner itself. Here's the thoughts I have so far:

1 - Mask shader http://wiki.unity3d.com/index.php/TextureMask . But this doesn't work because I want to stretch my image. Somehow I'd like to 9-slice the shader... If that were possible.

2 - Round-corner shader. I'm no shader expert but I guess I could draw/not draw pixels based on the y-coordinate, using a sine-function to make it round. That's what I'll try to figure out now.

Any idea which way would be better? Or is there a third way?ß

Cheers

4
Support / Create tk2dSpriteCollection on runtime
« on: August 13, 2013, 09:58:58 am »
Hey all,

This seems to be a pretty obvious problem. I have no experience with creating atlases on runtime and I fear it will be incredibly slow on mobile devices. However, it would save an immense number of drawcalls for me (currently on 200) so I am willing to look into it.

Question 1:
Can I create an atlas of several PNG's on runtime, like I can in the editor? I'm looking into tk2dSpriteCollectionData.CreateFromTexture, but it seems to only be useful when there's one texture which is the atlas.

Question 2:
Can I even, instead of recreating the complete atlas, replace only certain elements in the PNG?

Shot in the dark, but perhaps you guys can help me out.

Cheers!

Ivo

5
Support / Re: Creating atlas which is not to the power of 2
« on: July 06, 2013, 03:00:31 am »
Thanks for the reply!

So than what's the reason that I can't create an atlas which is not to the power of 2?

6
Support / Re: Creating atlas which is not to the power of 2
« on: July 04, 2013, 11:49:02 am »
Found this site - http://www.cocos2d-iphone.org/forums/topic/better-to-use-power-of-2-and-scale/

So if I use an image of 300*300 pixels, it takes as much memory as an image of 512*512... A reason to use bigger atlases, but in my case I will just resize my buildings to close to 256*256 pixels.

That's why. Good to know ;)

7
Support / Re: Randomized Isometric Map with material tiling
« on: July 04, 2013, 10:55:32 am »
Ok, I'll use the separate images. It turns out to be acceptable on performance.

Thanks so much!

8
Support / Creating atlas which is not to the power of 2
« on: July 04, 2013, 10:53:53 am »
Hey all,

Simple question and hopefully a simple solution. When I create a sprite collection it will always save as an image to the power of 2. Not sure why, but I am wasting some space here since I have some very small atlases (I found that in some cases saving images separately will increase performance).

Who can tell me how I can save the sprite collection to not be to the power of 2?

Cheers,

Ivo

9
Support / Randomized Isometric Map with material tiling
« on: July 03, 2013, 08:40:16 am »
Hey guys!

I'm currently creating an isometric grass map for my game. It's a grass field, tiled. Right now I use the tile-texture added to this post. I simply tile it on the material. This way it only costs me two polygons and the whole map is tiled. However, it looks very repetitive. I am hoping to be able to somehow use more than just these two tiles and still stay low on the polycount (Tilemap of 2D Toolkit seems to cost 2 polys/tile).

Any idea if this is possible? Otherwise I'll find a mid-way solution, with 3 bigger tile-blocks which I will place randomly screen (both memory cost and performance will only suffer a bit)

Cheers,

Ivo

10
Support / Re: Getting a triangular shape from atlas
« on: June 19, 2013, 11:54:23 am »
Forgot to say thanks before - this worked perfectly.

The custom mesh looked strange (did not match 100% with the preview in the 2D toolkit window) in the beginning, but I fixed it by setting Trimming to false.

Cheers!

11
Support / Getting a triangular shape from atlas
« on: June 13, 2013, 02:48:21 am »
Hey guys,

I am currently working with a map, with triangular corners and a tiled center. I am using 2DToolkit to create the atlas for me and (as expected) it saves the four corners next to each other, all as if they were four rectangles (please see attachment). Is there any way to save this in a different way and save half the space? I was thinking to use shaders, but I work for mobile device and I am not sure if that would work.

Would be easiest if I can get a triangular shape out of the atlas instead of a rectangle.

One solution I have - if I get the shapes in the atlas they way I want, I can just load the two rectangles twice and make the tiles overlap them. I am just wondering if there are other / better ways to do this.

Edit: And obviously it's easy to get the shapes in the atlas, I just put them together as one image..
Cheers,

Ivo

12
Support / Re: Drawcall efficient Z-sorting with multiple atlases
« on: May 28, 2013, 10:42:02 am »
Hey there!

Thanks for your reply.

The problem is that I use camera zooming, which makes it impossible to have the buildings as pixelperfect (right?). Actually, I am not familiar with alpha testing, but I'll look into it.

Another solution I came up with, would just be to separate every building in their own atlas. This adds way more drawcalls, but might be lighter because the atlases sent to the GPU are a lot smaller. Any thoughts on that perhaps?

I'll keep on testing ;)

13
Support / Drawcall efficient Z-sorting with multiple atlases
« on: May 27, 2013, 04:41:54 am »
Dear all,

Currently I am working on an mobile isometric strategy game, with multiple animated buildings. Since there are many buildings and they are quite detailed (high resolution) I can't fit all buildings in one atlas. In fact, I need 3 atlases (2048*2048) for all buildings. However, the user can move the buildings around and put them behind and in front of other buildings. This is easily done by z-sorting, but by having multiple atlases z-sorting, the drawcalls increase dramatically. Since it's a mobile game, I'm trying to decrease the number of drawcalls to 25, but now, every overlapping building (of a different atlas) costs one extra drawcall.

Does anyone have a smart solution to this problem? I'd get a 4096*4096 atlas, but I'd like an Ultra HD atlas as well, which would then require a 8192*8192 atlas and Unity doesn't seem to accept that.

Any help is greatly appreciated!

Cheers,

Ivo

Pages: [1]