Avoid drawing the model but still have properly lit render targets.
1 replies, posted
Sorry for posting in quick succession. So I am now rendering meshes instead of using the render drawing library, but as many of you know, when rendering here there are problems with lighting if you don't draw a model when used on an entity. Here's my code if you aren't sure what I'm talking about:
function ENT:Draw()
render.ModelMaterialOverride()
self:DrawModel()
render.Clear(255,255,255,255)
render.SetMaterial(boxmat)
SimRoomTesting:CubeMatrix(self,self.dim.x,self.dim.y,self.dim.z)
end
function SimRoomTesting:CubeMatrix(ent,x,y,z)
local matrix = Matrix( );
local dim = Vector( x, y, z )
matrix:Translate( LocalToWorld(dim / 2, Angle(0,0,0), ent:GetPos( ), ent:GetAngles( )) );
matrix:Rotate( ent:GetAngles( ) );
matrix:Scale( dim );
local up = Vector( 0, 0, 1 );
local right = Vector( 1, 0, 0 );
local forward = Vector( 0, 1, 0 );
local down = up * -1;
local left = right * -1;
local backward = forward * -1;
cam.PushModelMatrix( matrix );
mesh.Begin( MATERIAL_QUADS, 6 );
mesh.QuadEasy( up / 2, up, 1, 1 );
mesh.QuadEasy( down / 2, down, 1, 1 );
mesh.QuadEasy( left / 2, left, 1, 1 );
mesh.QuadEasy( right / 2, right, 1, 1 );
mesh.QuadEasy( forward / 2, forward, 1, 1 );
mesh.QuadEasy( backward / 2, backward, 1, 1 );
mesh.End( );
cam.PopModelMatrix( );
end
If the model is drawn, then there are no problems. However if the model is not drawn (which is what I want to happen) then the lighting is messed up and creates all sorts of issues. So my question is how do I either
A) draw an invisible model
B) avoid drawning the model but still have properly lit textures.
Thanks in advanced!
You could make/find a transparent model and spawn that.
Sorry, you need to Log In to post a reply to this thread.