Maximum of How many textures can be drawn inside 4 vertex data - swift

I have two squares with six vertex as in the image. I want to add texture to them I want to add same texture about 30 times between two squares in metal is it Possible ? To my understanding I could able to add two textures
Is it possible add about 30 times same textures between two square

Related

Variations in sprite shape textures

I am currently trying out how to work with sprite shapes. I know how we can put different textures on different angles but Suppose i wanted to make variations with different images(sprites) on a single surface. For example, i want to make spots with puddle textures on a grass plain land. How will i do that?
I tried adding different textures in different angles but I couldn't figure out how i can change the repeating texture and make variations in a single surface in a sprite shape.

How to blend textures on 2 objects

I am writing a topdown shooter, where the player constantly moves to the right to progress. I cubes (plates) that are used as the floor as the player advances through the game.
Each plate has a different texture - snow, grass, etc - which I choose at random.
The question - how do I blend the textures on one plate with the following plate. I assume I will have to spawn them overlapping, but I don't know what technique to use to gradually transition from one to the other.
I'm not looking for a full written solution, just a nudge in the right direction so I can look up the right terms to start learning how to do this.
Vertex Colors: You could color each cube with vertex colors, but that would typically limit you to 3 or 4 different textures to blend between... Also the transition is hard when the cubes are just overlapping. If you have a single object (consisting of connected cubes) you could make use of the blended vertex colors.
The texture blending can be achieved like this:
Vertex Colors blue and black, you can see the blending between the areas (blurry gradient)
If you blend like this:
You will get this:
And if you also use a height-map + PBR maps, it can look like this:
I guess this approach is very limiting to the number of possible blocks.
Tiles:
Like in 2D Tile Editors, you need to model/texture different objects to use between your cubes. Example:
Grass Cube - Transition Cube - Sand Cube
And then you need a transition Cube for every possible transition.
The amount of required transitions grows fast when you add base blocks!
Tiles Source Kenney.nl
That could be combined with Wave Function Collapse which was used in TownScaper.

Why is my Unity plane seemingly 10 times too big

I'm a relative Unity noob. I have a fairly simple scene. Currently in the following you will see a plane (object WorldTilemapGfx) and 2 sprites (Tile C: 0 R: 0, and Tile C: 1 R: 0).
In the following picture you see I've selected one of the sprites. Its scale is 1 x 1, and its at position 1, 0.
Now I select the other sprite.
So far the positions and sizes seem ok.
Now if I select the game object with a "plane" mesh it shows in the inspector as scale 2, 1. This is the scale I expect since it is supposed to be as wide as two of the tiles above, and as high as only 1 of them.
However its visually 10 times too big.
If I increase the X scale of one of my tiles by 10, then the relative sizes between tile and plane look ok
Also the image used for my tile is 256 x 256.
Can someone suggest what I am missing? Thanks.
See Unity Mesh Primitives
Plane
This is a flat square with edges ten units long oriented in the XZ plane of the local coordinate space. It is textured so that the whole image appears exactly once within the square. A plane is useful for most kinds of flat surface, such as floors and walls. A surface is also needed sometimes for showing images or movies in GUI and special effects. Although a plane can be used for things like this, the simpler quad primitive is often a more natural fit to the task.
whereas
Quad
The quad primitive resembles the plane but its edges are only one unit long and the surface is oriented in the XY plane of the local coordinate space. Also, a quad is divided into just two triangles whereas the plane contains two hundred. A quad is useful in cases where a scene object must be used simply as a display screen for an image or movie. Simple GUI and information displays can be implemented with quads, as can particles, sprites
and “impostor” images that substitute for solid objects viewed at a distance.
Ok.. confirmed using a Quad gave me what I expected in scale.. I now understand that the underlying plane mesh is actually 10 x 10 in size.
https://forum.unity.com/threads/really-dumb-question-scale-of-plane-compared-to-cube.33835/#:~:text=aNTeNNa%20trEE%20said%3A-,The%20plane%20is%20a%2010x10%20unit%20mesh.,a%20quick%20floor%20or%20wall.

How to have a generator class in shader glsl with amplify shader editor

i want to create a shader that can cover a surface with "circles" from many random positions.
the circles keep growing until all surface covered with them.
here my first try with amplify shader editor.
the problem is i don't know how make this shader that create array of "point maker" with random positions.also i want to controll circles with
c# example:
point_maker = new point_maker[10];
point_maker[1].position = Vector2.one;
point_maker[1].scale = 1;
and etc ...
Heads-up: That's probably not the way to do what you're looking for, as every pixel in your shader would need to loop over all your input points, while each of those pixels will only be covered by one at most. It's a classic case of embracing the benefits of the parallel nature of shaders. (The keyword for me here is 'random', as in 'random looking').
There's 2 distinct problems here: generating circles, and masking them.
I would go onto generating a grid out of your input space (most likely your UV coordinates so I'll assume that from here), by taking the fractional part of the coords scaled by some value: UV (usually) go between 0 and 1, so if you want 100 circles you'd multiply the coord by 10. You now have a grid of 100 pieces of UVs, where you can do something similar to what you have to generate the circle (tip: dot product a vector on itself gives the square distance, which is much cheaper to compute).
You want some randomness, so you need to add some offset to the center of the circle. You need some sort of random number (there might be some in ASE I can't remember, or make one your own - there's plenty of that you look online) that is unique per cell of the grid. To do this you'd input the remainder of your frac() as value to your hash/random method. You also need to limit that offset depending on the radius of the circle so it doesn't touch the sides of the cell. You can overlay more than one layer of circles if you want more coverage as well.
Second step is to figure out if you want to display those circles at all, and for this you could make the drawing conditional to the distance from the center of the circle to an input coordinate you provide to the shader, by some threshold. (it doesn't have to be an 'if' condition per se, it could be clamping the value to the bg color or something)
I'm making a lot of assumptions on what you want to do here, and if you have stronger conditions on the point distribution you might be better off rendering quads to a render texture for example, but that's a whole other topic :)

Open GL - ES 2.0 : Dynamically Changing the color

In most of the tutorials in opengl es they create a structure which holds the vertices of the geometry. This structure contains the position and color for each vertex. This vertex information is then sent to the vertex buffer and is then used to render the geometry on the screen. My question is if I want to draw 2 cubes on the screen do I need to create 2 different structures objects or can I get by just creating a single structure and then changing the color dynamically.
This is the definition of my structure
struct Vertex{
float Position[3];
float Color[4];
}
Yes you can use just one instance of the structure, draw it, than change the colors of it and draw it again with another world matrix. Though I don't think that would be very good for performance.
But the best thing to do would be to create two instances of that one structure each one containing different colors, then draw them in differents positions by multiplying a translation matrix to their world matrix.