Jump to content

Objects highlighting.


lxFirebal69xl
 Share

Recommended Posts

I've been looking into making specific objects highlight when the player gets close to them.

 

So far the closest thing I found is an old shader called edgeglow, but I have no clue how I would apply that to a model.

 

3471-0-1448783501.jpg

 

This picture is kind of what I'm going for, but not as intensive, more just the actual outline of the entities.

Link to comment
Share on other sites

A quick and dirty way is to make a copy of the object, scale it slightly larger, and flip its normals.

Script.highlight = Model:Load("Models/crates/crate_large.mdl", Asset.Unmanaged)

function Script:Start()

self.highlight:SetScale(1.01,1.01,1.01)

self.hmat = Material:Create()

self.hmat:SetColor(0,1,0,1)

self.hmat:SetSortMode(true)

self.highlight:SetMaterial(self.hmat)

self.surface = self.highlight:GetSurface(0)

self.surface:FlipNormals()

self.highlight:SetPosition(self.entity:GetPosition())

self.highlight:SetParent(self.entity)

end

post-14-0-23002600-1479860267.jpg

 

A more complicated way involves rendering to another buffer/world, performing an edge-detection/cartoon post process shader on the scene, and then drawing the results to your main world.

 

Edit--Doing the quick and dirty way looks pretty decent once you set the zsort to true on the flipped material.

  • Upvote 3

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

A model fresnel shader will also do this, but since it uses normals, stuff like boxes and other very low poly stuff wil look not so good.

 

A quick and dirty way is to make a copy of the object, scale it slightly larger, and flip its normals.

 

this is neat and requires no special stuff. :)

  • Upvote 1

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...