Jump to content

Animated workshop waternormals usage example


shadmar
 Share

Recommended Posts

Josh's animated waternormals :

http://steamcommunity.com/sharedfiles/filedetails/?id=239702606

 

Script.Material = ""--path

 

function Script:Start()

self.textures = { }

 

-- Fetch workshop animated water normals

for x=0,9,1

do

local name = "water1_0"..x..".tex"

self.textures[x] = Texture:Load(name,0,239702606)

end

for x=10,63,1

do

local name = "water1_"..x..".tex"

self.textures[x] = Texture:Load(name,0,239702606)

end

 

-- Load material

self.mat = Material:Load(self.Material)

self.entity:SetMaterial(self.mat)

 

self.index=0

end

 

function Script:UpdateWorld()

-- Animate normals for texture1 for material

if self.index > 63 then self.index=0 end

local count = 0

self.index=self.index+Time:GetSpeed()*0.5

count=math.floor(self.index)

self.mat:SetTexture(self.textures[count],1)

end

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

If you have a friend in the group on Steam, they can invite you.

 

You don't even need to subscribe to the package, it will just be downloaded automatically when you make that call. (Requires the latest beta.)

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

self.Material is the same as Script.Material at the top of the script which is a parameter to the script. You fill that in from the editor with whatever material you want that's in your project folder. So you attach this script to anything (a plane I would guess would be best) and assign that Material parameter which will show up in the editor when you attach the script.

  • Upvote 1
Link to comment
Share on other sites

I'm "upgrading" the old water prefab to use these instead, this example was just my excercise to load workshop items.

But uf you just use the concrete material in my example above on a simple CSG brush, it will look like very very very shallow water on conrete for example.

  • Upvote 2

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...