Different repeating texture options.
How did you do this?
it’s a really simple bit of code in the Fragment Shader.
Declare 2 uniform variables to accept the texture tile input and a control for the size of the tile
uniform float TileSize; // Range 0.0 > 1.0
uniform sampler2D TileImg;
Then within the main loop of the Frag Shader
vec2 xy = gl_TexCoord.xy;
vec2 phase = fract(xy / TileSize);
vec4 texTile = texture3D(TileImg,phase);
Then, to combine the texture image with lighting results etc.
gl_FragColor = Color * Lighting * TexTile;
[where ‘lighting’ is a vec4 result of lighting calculations]
The tile should be a square image with a white background and darker foreground. In this example, I had six different tiles, and switches between them with a multiplexer before piping them into the shader.
Hope this helps a bit.
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
RSS - Posts
RSS - Comments
Error: Twitter did not respond. Please wait a few minutes and refresh this page.