havenphillip Posted October 9, 2019 Share Posted October 9, 2019 If I drag a material onto a model or brush, how can I then reference that material from a code placed on that object or brush without having to create a material then add a bunch of textures? I just want to reference the material I put on it. Something like a Material:GetCurrent() for the entity? Quote Link to comment Share on other sites More sharing options...
havenphillip Posted October 9, 2019 Author Share Posted October 9, 2019 Actually I see GetSurface() but I'm getting this funky looking rock which ought to look more like the second picture. Here's my code here so far: function Script:Start() --mat = Material:Load("Gloss/wet_rock.mat") mat = Material:Create() surface = self.entity:GetSurface(0) surface:SetMaterial(material) shader = Shader:Load("Gloss/wet_rock.shader"); mat:SetShader(shader) self.entity:SetMaterial(mat) shader:SetFloat("puddlesize", self.puddleSize) shader:SetFloat("puddlefade", self.puddleFade) shader:SetFloat("intensity" , self.intensity) mat:Release() end Quote Link to comment Share on other sites More sharing options...
havenphillip Posted October 9, 2019 Author Share Posted October 9, 2019 Ah ok I see. But now it's blue, even though the color is set to 1,1,1. How do I fix that?: surface = self.entity:GetSurface(0) mat = surface:GetMaterial() mat:SetColor(1,1,1) shader = Shader:Load("Gloss/wet_rock.shader"); mat:SetShader(shader) self.entity:SetMaterial(mat) shader:SetFloat("puddlesize", self.puddleSize) shader:SetFloat("puddlefade", self.puddleFade) shader:SetFloat("intensity" , self.intensity) mat:Release() Quote Link to comment Share on other sites More sharing options...
havenphillip Posted October 9, 2019 Author Share Posted October 9, 2019 Ah it's my shader. I got it. Thanks for reading lol 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.