Tag Info

Hot answers tagged

6

Basically, I think what you do is first of all create a tile for each of your terrain types that seamlessly tiles with itself. As you said there are many tutorials available on how to do this. Once you have those tiles, you can draw variants as well as transitions between different types of terrain by modifying copies of them. The only thing you need to ...


2

The answer to this question here should help explain how to use the GetData function. Basically, the data is stored in the return array from the GetData call is formed by reading the 2D texture from left to right, top to bottom, transforming it as follows: AAAA BBBB => AAAABBBBCCCCDDDD CCCC DDDD To determine where a given pixel in the 1D array is, we ...


2

From your original equation a_position.x = a_position.x + amplitude * sin(phase + a_position.x); We'll just be taking at look at the sin portion as this is where this effect comes from sin(phase + a_position.x); Let's look at the sin function over a half of a period for different positions (phase is in degrees) Position 1 - a_position.x = 0 sin(0 + 0) ...


2

What exactly is the difference between Tiling the material and Offset of material? Those parameters set by the inspector are used inside the shader to scale the texture coordinates. A uniform float4 in the shader with the name of the texture and _ST suffix is populated with those values. For example considered the main texture: float2 scaled_uv = ...


2

You need to combine texture atlas techniques with your existing triplanar shader so that you can easily switch the "textures" being used based on the terrain type in the voxel. One technique if you are using shared vertices between voxels might be to use vertex color or UV coords to encode all the terrain types associated with a particular vertex, then you ...


1

You are going to have background rendered either way. OpenGL redraws the whole frame each time. So what does it matter for performance where are you drawing it from? :) It does not matter, unless you are doing some heavy computations to generate the background on CPU. What you probably do is just updating the background location each frame (position, ...


1

You could do this: Create a texture holding all the colors you want. For the actual button geometry, set the texture coordinates to the appropriate region of the color texture (they can all be the same value, in fact).


1

Documentation on the website which also happens to be the first search result for the term SetTextureOffset or mainTextureOffset seems to sum up the issue nicely. Material.SetTextureOffset function SetTextureOffset (propertyName : String, offset : Vector2) : void Description Sets the placement offset of texture propertyName. Common texture names used by ...


1

You can use Texture2D.GetData() to copy texture pixel data to a Color[] in XNA. Texture2D texture=Content.Load<Texture2D>("asd"); Color[] tcolor=new Color[texture.Width*texture.Height]; texture.GetData<Color>(tcolor); After you have your Color array, you can do whatever you want with it, for example you could change certain colored pixels to ...


1

You can use the inbuilt GLSL lessThan() and greaterThan() functions (supported in all GLSL versions). These give two boolean vectors as a result. https://www.opengl.org/sdk/docs/man/html/greaterThan.xhtml http://www.opengl.org/sdk/docs/man4/html/lessThan.xhtml Then, you can use 'equal' (https://www.opengl.org/sdk/docs/man/html/equal.xhtml) on those ...


1

How about: vec3 delta = abs(textureColor - vec3(0.85, 0.85, 0.85)); // Get delta from middle vec3 if (delta.r <= 0.05) && (delta.g <= 0.05) && (delta.b <= 0.05) Performance needs to be profiled, but it's sure shorter to write



Only top voted, non community-wiki answers of a minimum length are eligible