Texture Offsets 2019

I can’t wait to use this with my upcoming project. Gun skins will be on another level with this. Looking forward to see what everyone creates with it.

1 Like

This is going to come in handy for so many projects!

Some fantastic updates recently, and I’ve been hearing news of Developer Subscriptions coming soon too :smiley:

1 Like

If anyone is looking to automate a fix for this issue, this is the solution I came up with:

local normalIdToAxis =
{
	Left   = 'X';
	Right  = 'X';
	Top    = 'Y';
	Bottom = 'Y';
	Front  = 'Z';
	Back   = 'Z';
}

local function selectUVSize(part, normalId)
	if typeof(normalId) == "EnumItem" then
		normalId = normalId.Name
	end
	
	local axis = normalIdToAxis[normalId]
	local size = part.Size
	
	if axis == 'X' then
		return size.Z, size.Y
	elseif axis == 'Z' then
		return size.X, size.Y
	elseif axis == 'Y' then
		return size.X, size.Z
	end
end

local function alignTexture(texture)
	local texU, texV = selectUVSize(part, texture.Face)

	local alignU = string.format("%i", (texU % 2) + .5)
	local alignV = string.format("%i", (texV % 2) + .5)
	
	texture.OffsetStudsU = (alignU == '1' and .5 or 0)
	texture.OffsetStudsV = (alignV == '1' and .5 or 0)
end

This code determines whether the UV dimensions of the texture are even or odd, and adjusts the OffsetStuds properties accordingly.

I used string.format because I was trying to get a “round to nearest” result, so dimensions with floating point errors wouldn’t snap to the wrong offset. I’m sure there’s a better way to handle this, but math.ceil & math.floor were giving me issues for some reason.

24 Likes

That’s an amazing idea. Is that in Roblox?

1 Like

Wow this is an amazing feature. The possibilities are endless! I can’t wait to do things like animated skins and stuff for items!

1 Like

Really nice update, can’t wait to try it out!

2 Likes

No, not at all… it’s definitely from Call of Duty.

2 Likes

This will be perfect for animating doors, wood grain, and more! Thanks for the update, @zeuxcg!

1 Like

No, it’s from Call of Duty.
I posted it to reference what we could potentially do now.

2 Likes

This is such a beautiful update. I’ve been waiting for this for my entire lifetime.

1 Like

Now we need rotations (or 90 degree rotations) for both Textures AND decals.

2 Likes

Energy Sword from Halo, anyone?

3 Likes

I think that’s doable with the forcefield material as well.

1 Like

I used an image strip to make a gif-like animated texture using the offset, but unfortunately the texture seems to be incredibly low quality even though i uploaded a high quality texture



(Obviously the first gif i tested had to be nick)

EDIT: If anyone wants to try out this gif thing, here’s the script

-- Script by HungryBoy02

local Frames = 18 --Amount of frames in gif

local fps = 24 -- Max 30

local size = script.Parent.Parent.Size -- The gif should be on the front of the part

script.Parent.StudsPerTileU = Frames*size.X

script.Parent.StudsPerTileV = size.Y

while wait(1/fps) do

    script.Parent.OffsetStudsU = script.Parent.OffsetStudsU + size.X

    if script.Parent.OffsetStudsU > script.Parent.StudsPerTileU then

        script.Parent.OffsetStudsU = 0

    end

end

(This script should be inside a texture instance inside a part)

And a texture I used:

19 Likes

This is another great addition that ROBLOX has decided to make to take the platform to the next level! The changes allow for even more development possibilities. Keep it up ROBLOX.

I remember trying to make a scrolling effect with textures a few years back and stopped when I couldn’t recreate this feature! This much needed update has finally been fulfilled.

Hats off to @devHoodie for making a perfect example of this!

6 Likes

14 Likes

Awesome! Now we can make animated textures!

You don’t have to apologize for the wait, it was worth it! This feature will definitely help with my games when adding details to meshes with textures, I can’t thank you enough…