'Mirroring' clientside models

Hello, Im wondering is there a way to ‘mirror’ clientside models? (for example how viewmodel can be mirrored by ViewModelFlip)

Im trying to bonemerge clientside hands with CSS viewmodels and the problem occurs when my CSS viewmodel is flipped - clientside model looks like its turned from inside out.

You could try to scale it with a -1 value **[Entity.SetModelScale

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.SetModelScale)**, this would reverse all the triangles. The problem with this is it will reverse the order of the vertices, causing the engine to cull (not draw) the ones on the outside because they are now counter clockwise. This would make the inside vertices clockwise, since the engine doesn’t cull these, they would be visible.
The reason the engine does this is to optimize rendering. When triangles are facing the camera, their vertices are clockwise, when they are facing the oposite direction, they are counter clockwise. It is far cheaper to check if vertices are clockwise than to render the triangle, so it improves FPS and rastering time.

You would have to find a way to disable or reverse (make it cull clockwise vertices) culling for this.

Though, if you scale it negatively in only one direction I am not sure what would exactly happen, but I think it would still have culling issues.


I’m having this problem as well. Nothing fixes it. Tried SetModelScale, render.CullMode, every possible combination of the two, it doesn’t make a single difference, the culling issue still happens. If someone has a working solution, that would be really nice.

Did you set it to MATERIAL_CULLMODE_CCW? If you set it to MATERIAL_CULLMODE_CW, it doesn’t do anything at all because that’s what its set to by default.
[lua]ent = ClientsideModel(“your model here”, RENDERGROUP_OPAQUE)
ent:SetModelScale(Vector(-1,1,1)) //to flip on the x-axis (I think that’s what you want, if it doesn’t work try the y-axis.
function DrawModel()

EDIT: Or is it the other way around? I am confuzzled today.

This code actually works on clientside model unless I apply EF_BONEMERGE to it :confused:

Of course I tried both ways. It just doesn’t work when the model is bonemerged to another.