Source Filmmaker

Source Filmmaker

Phobias Oct 2, 2018 @ 8:39am
Having a hard time getting refract to work [solved]
First off I'm not referring to eye refract just regular refract like here: https://developer.valvesoftware.com/wiki/Refract

I looked at an existing model and pretty much mimicked the vmt codes and a bit iffy as to whether or not the materials were done correctly. I've done a simple panel that I'm trying to get it to refract with an animated bump map. 5 planeskins but mainly working on the first one at the moment.

here are their codes:
https://imgur.com/a/TkKUx68

The material is just full alpha.
the model picks up on the translucent command but won't follow the refract.
Any ideas what I might be doing wrong?
Last edited by Phobias; Oct 2, 2018 @ 3:12pm
< >
Showing 1-10 of 10 comments
Pte Jack Oct 2, 2018 @ 9:10am 
I might be totally out to lunch here as I don't know this material or how it really works but, I don't see anywhere in your VMTs where you call one from the other (In other words, planeskin1 doesn't call planeskin1_refract or planeskin1_refract doesn't call planeskin1).

So how does the refract material get loaded onto the model in the first place?
Phobias Oct 2, 2018 @ 9:57am 
Originally posted by Pte Jack:
I might be totally out to lunch here as I don't know this material or how it really works but, I don't see anywhere in your VMTs where you call one from the other (In other words, planeskin1 doesn't call planeskin1_refract or planeskin1_refract doesn't call planeskin1).

So how does the refract material get loaded onto the model in the first place?

I thought so to but other than take an arrow to the knee the vmt whos code I copied over don't address each other either yet it works somehow. Here: https://imgur.com/a/wMqRhZu

Mind you that model i'm copying is an old bullet trail that has two skins one that refracts and one that is partly translucent. One material seems to be for the side view the other looks to be the front view if that makes sense. All of the old model's materials here:
https://imgur.com/a/9ovrgIu

To add to the confusion the old model's VMT codes mentioned of a dudvmap addressing it to the same file as the other materials I linked in the paragraph above this one. There's no dudvmap in that file just what's on the image. one normal map, two basetextures and no dudvmap makes no sense, yet it all works somehow.

So I guess we're both confused about this.
Pte Jack Oct 2, 2018 @ 10:02am 
Can you link the model or if it's a TF model, give me the .mdl name your using as a reference?
Phobias Oct 2, 2018 @ 10:09am 
Originally posted by Pte Jack:
Can you link the model or if it's a TF model, give me the .mdl name your using as a reference?

Not a clue how to link the model's mdl over. unless you use discord
Last edited by Phobias; Oct 2, 2018 @ 10:09am
Pte Jack Oct 2, 2018 @ 10:12am 
Where did you get the model and skins you're using as the ref for your project?
Phobias Oct 2, 2018 @ 10:13am 
Originally posted by Pte Jack:
Where did you get the model and skins you're using as the ref for your project?

It's an old model that use to be in the SFM workshop but it got taken down for unknown reasons I just kept the files.
Marco Skoll Oct 2, 2018 @ 10:44am 
I may not be following the problem correctly, but I would suggest checking that the model you're referencing doesn't have duplicate geometry so that the same area is using two materials simultaneously.

For example, my character Athena has hair that has duplicate geometry in order that it can use different versions of the materials with respectively $translucent and $alphatest to give soft transparency that nonetheless casts shadows - providing a more realistic result than most models in Source:
https://steamcommunity.com/sharedfiles/filedetails/?id=1353605136
No, it's not perfect (there's still a somewhat rough edge around where the $alphatest cuts off the transparency), but the point is, duplicate geometry is a way to have the same area affected by more than one material, so I'd check.
Last edited by Marco Skoll; Oct 2, 2018 @ 10:48am
Pte Jack Oct 2, 2018 @ 12:13pm 
Ok, the model itself has 2 skins calls the vmts via a TextureGroup.

$texturegroup "skinfamilies"
{
{ "BulletTrail" "BulletTrailEnds" "bullettrail_refract" "bullettrailends_refract" }
{ "bullettrail_refract" "bullettrailends_refract" "bullettrail_refract" "bullettrailends_refract" }
}

This is how the refract material gets placed on the model, they are different skins, as I suspected after seeing your screen shot.

The Refract shader can use an animated normalmap or a dudvmap to detrmine the pattern of the refract however The $dudvmap command is now obsolete. the $dudvmap command here is most likely something for backward compatibility but is being ignored by SFM. SFM is using the $normalmap command here.

See here

https://developer.valvesoftware.com/wiki/Du/dv_map

https://i.imgur.com/oi5nMCu.png

If you didn't include a texturegroup to the QC, then you can't switch between the normal and the refract materials.

Last edited by Pte Jack; Oct 2, 2018 @ 12:28pm
Phobias Oct 2, 2018 @ 1:14pm 
Originally posted by Pte Jack:
Ok, the model itself has 2 skins calls the vmts via a TextureGroup.

$texturegroup "skinfamilies"
{
{ "BulletTrail" "BulletTrailEnds" "bullettrail_refract" "bullettrailends_refract" }
{ "bullettrail_refract" "bullettrailends_refract" "bullettrail_refract" "bullettrailends_refract" }
}

This is how the refract material gets placed on the model, they are different skins, as I suspected after seeing your screen shot.

The Refract shader can use an animated normalmap or a dudvmap to detrmine the pattern of the refract however The $dudvmap command is now obsolete. the $dudvmap command here is most likely something for backward compatibility but is being ignored by SFM. SFM is using the $normalmap command here.

See here

https://developer.valvesoftware.com/wiki/Du/dv_map

https://i.imgur.com/oi5nMCu.png

If you didn't include a texturegroup to the QC, then you can't switch between the normal and the refract materials.

Makes sense I guess just got to skin group them togeather, however like i said earlier there were two basetextures and a normal map none of which had the word refract only the VMTs did. so judging by you pic you got to write in the VMT name too?
Last edited by Phobias; Oct 2, 2018 @ 1:14pm
The author of this thread has indicated that this post answers the original topic.
Pte Jack Oct 2, 2018 @ 2:09pm 
This is a sample of setting up a refract skin on a model....

https://steamcommunity.com/sharedfiles/filedetails/?id=1528872967
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Oct 2, 2018 @ 8:39am
Posts: 10