Source Filmmaker

Source Filmmaker

CUSTOM MIRROR REFLECTION ISSUES
I HAVE A MODEL I FOUND FROM XNALARA ITS A GOTHIC LOOKING MIRROR AND I WANTED TO MAKE IT LOOK LIKE A BLACK MIRROR...THE ONLY THING IS...THE "GLASS" TEXTURE IS TRANSPARENT FOR OEN THING AND IDK IF IT'S AN ISSUE ALONE, AND TO IDK HOW TO MAKE THE GLAS REFLECT LIKE A MIRROR, RIGHT NOW ITS SEE THROUGH.... IS IT POSSIBLE TO MAKE A MIRROR MODELS GLASS HAVE A REFLECTION?

HERE'S THE V,MT INFO IN CASE YOU NEED IT...IT DID NOT COME WITH A NORMAL MAP BUT IF I HAVE TO I CAN "MAKE" ONE WITH A GIMP PLUGIN.

VertexLitGeneric
{
$basetexture "models/black_mirror/mirror_glass_color"

"$translucent" 1
"$envmap" "env_cubemap"
"$envmaptint" "0.475 0.475 0.475"
$surfaceprop metal

"$phong" "1"
"$phongexponent" "8"
"$phongboost" "10"
"$phongfresnelranges" "[0.05 0.5 1]"
"$phongalbedotint" "1"

$halflambert 0
$diffuseexp 1.5
}

SO, AGAIN, IS IT POSSIBLE TO MAKE THE TEXTURE BLACK AND HAVE IT REFLECT WELL LIKE AN ACTUAL MIRROR?
Last edited by GORYGIRL1996; Jul 6, 2018 @ 9:18pm
< >
Showing 1-15 of 15 comments
Zappy Jul 7, 2018 @ 3:42am 
IF YOU DON'T WANT IT TO BE SEE-THROUGH, A GOOD IDEA WOULD PROBABLY BE TO REMOVE THE $TRANSLUCENT 1 LINE FROM THE MATERIAL.

TO MAKE THE BASE TEXTURE APPEAR DARKER, YOU CAN EITHER MAKE THE TEXTURE ITSELF DARKER, OF COURSE, OR YOU CAN SPECIFY $COLOR IN THE MATERIAL, FOLLOWED BY A MULTIPLIER FOR HOW BRIGHT/DARK YOU WANT THE BASE TEXTURE TO BE.
FOR EXAMPLE, $COLOR 1 MAKES NO DIFFERENCE, $COLOR 0.5 MAKES IT DARKER, AND $COLOR 2 MAKES IT BRIGHTER.

TO MAKE THE $ENVMAP REFLECTIONS BRIGHTER OR DARKER, YOU CAN DO THE SAME WITH $ENVMAPTINT.

NO, IT'S NOT POSSIBLE TO HAVE ACTUAL REAL REFLECTIONS. (IT IS TECHNICALLY POSSIBLE, BUT ONLY ON FLAT SURFACES, AND NOT ON MODELS.)
Marco Skoll Jul 7, 2018 @ 6:13am 
Originally posted by GORYGIRL1996:
IT DID NOT COME WITH A NORMAL MAP BUT IF I HAVE TO I CAN "MAKE" ONE WITH A GIMP PLUGIN.
You will need some form of Phong mask for the Phong to work, and as the base texture appears to be using its alpha layer for transparency, $BasemapAlphaPhongMask won't be a very helpful substitute.

Personally, I'd recommend removing the alpha layer on the base map, as it seems you don't want the transparency anyway, and it'll just be pushing up the texture's file size unnecessarily.
At that point, it's up to you whether your Phong mask is the Basemap's alpha layer or the $bumpmap's alpha layer.

(The phong will still work if the map used has no dedicated alpha layer, as it assumes an alpha layer of 255 - but you do need something to use as a Phong mask).

~~~~~

Anyway, as Zappy says, actual reflections can only be handled on flat map brushes.

It can be faked to a degree using tricks like rt_cameras - here, the reflections on the window in the background are from a second camera, set up on the far side of the window, used as an $additive texture on a transparent model.
https://steamcommunity.com/sharedfiles/filedetails/?id=1416276997
(The second camera's nearZ setting is cranked up a lot here - to get the most realistic reflection, the second camera's position should be effectively reflected in the mirror itself. However, that would have meant it looking through several walls... but by cranking up the nearZ setting, it can be made to ignore anything that's too close).

This will only work reasonably on flat objects, with the camera not at too high an angle to the mirror. (Otherwise the perspective will be off).

I'm also wondering about the idea of faking reflections on more complex shapes with animated cubemaps, but this will be much more intensive, definitely not "realtime" (the cubemaps will need to be rendered in advance), and I'm not yet sure how well the results will actually work.
GORYGIRL1996 Jul 7, 2018 @ 1:36pm 
Originally posted by Zappy:
IF YOU DON'T WANT IT TO BE SEE-THROUGH, A GOOD IDEA WOULD PROBABLY BE TO REMOVE THE $TRANSLUCENT 1 LINE FROM THE MATERIAL.

TO MAKE THE BASE TEXTURE APPEAR DARKER, YOU CAN EITHER MAKE THE TEXTURE ITSELF DARKER, OF COURSE, OR YOU CAN SPECIFY $COLOR IN THE MATERIAL, FOLLOWED BY A MULTIPLIER FOR HOW BRIGHT/DARK YOU WANT THE BASE TEXTURE TO BE.
FOR EXAMPLE, $COLOR 1 MAKES NO DIFFERENCE, $COLOR 0.5 MAKES IT DARKER, AND $COLOR 2 MAKES IT BRIGHTER.

TO MAKE THE $ENVMAP REFLECTIONS BRIGHTER OR DARKER, YOU CAN DO THE SAME WITH $ENVMAPTINT.

NO, IT'S NOT POSSIBLE TO HAVE ACTUAL REAL REFLECTIONS. (IT IS TECHNICALLY POSSIBLE, BUT ONLY ON FLAT SURFACES, AND NOT ON MODELS.)
THANK U I WILL TRY ALL THOSE THINGS, AND AWW DANG IT! THAT SUCKS! WHY IS IT THAT IT WORKS FOR MIRRORS IN MAPS BUT NOT MIRROR MODELS THAT'S NOT RIGHT.
BUT YES I WILL TYR THOSE METHODS AND SEE WHAT HAPPENS....I FIGURED I WOULD NEED TO DELETE THE ALPHA CHANNEL ANY WAY'S BUT I JUST WANTED TO BE SURE.
GORYGIRL1996 Jul 7, 2018 @ 1:38pm 
Originally posted by Marco Skoll:
Originally posted by GORYGIRL1996:
IT DID NOT COME WITH A NORMAL MAP BUT IF I HAVE TO I CAN "MAKE" ONE WITH A GIMP PLUGIN.
You will need some form of Phong mask for the Phong to work, and as the base texture appears to be using its alpha layer for transparency, $BasemapAlphaPhongMask won't be a very helpful substitute.

Personally, I'd recommend removing the alpha layer on the base map, as it seems you don't want the transparency anyway, and it'll just be pushing up the texture's file size unnecessarily.
At that point, it's up to you whether your Phong mask is the Basemap's alpha layer or the $bumpmap's alpha layer.

(The phong will still work if the map used has no dedicated alpha layer, as it assumes an alpha layer of 255 - but you do need something to use as a Phong mask).

~~~~~

Anyway, as Zappy says, actual reflections can only be handled on flat map brushes.

It can be faked to a degree using tricks like rt_cameras - here, the reflections on the window in the background are from a second camera, set up on the far side of the window, used as an $additive texture on a transparent model.
https://steamcommunity.com/sharedfiles/filedetails/?id=1416276997
(The second camera's nearZ setting is cranked up a lot here - to get the most realistic reflection, the second camera's position should be effectively reflected in the mirror itself. However, that would have meant it looking through several walls... but by cranking up the nearZ setting, it can be made to ignore anything that's too close).

This will only work reasonably on flat objects, with the camera not at too high an angle to the mirror. (Otherwise the perspective will be off).
I'm also wondering about the idea of faking reflections on more complex shapes with animated cubemaps, but this will be much more intensive, definitely not "realtime" (the cubemaps will need to be rendered in advance), and I'm not yet sure how well the results will actually work.

THANK U FOR THE ADVICE ON THE CAM, I WILL PROBABLY TRY THAT, ONCE I GET BETTER AT POSING CAMERAS/ANIMATING.
Zappy Jul 7, 2018 @ 1:44pm 
Originally posted by GORYGIRL1996:
- AWW DANG IT! THAT SUCKS! WHY IS IT THAT IT WORKS FOR MIRRORS IN MAPS BUT NOT MIRROR MODELS THAT'S NOT RIGHT. -
TECHNICALLY, IT DOESN'T WORK FOR "MIRRORS" IN MAPS, BUT RATHER "WATER" IN MAPS. AND IT DOESN'T WORK ON MODELS BECAUSE WATER REFLECTION ONLY WORKS ON MAP BRUSHES, AND SPECIFICALLY ONLY FLAT ONES.

EDIT: NOW THAT I THINK ABOUT IT, IT ALSO WORKS FOR ACTUAL NON-WATER MIRRORS IN MAPS (I THINK), BUT STILL ONLY ON FLAT SURFACES.
Last edited by Zappy; Jul 7, 2018 @ 1:45pm
Marco Skoll Jul 7, 2018 @ 2:01pm 
Originally posted by GORYGIRL1996:
WHY IS IT THAT IT WORKS FOR MIRRORS IN MAPS BUT NOT MIRROR MODELS THAT'S NOT RIGHT.
Mirrors are actually a really difficult thing to handle in a game engine. The idea of having to handle light bounces massively complicates the maths involved.
Many engines can't handle it at all, particularly engines the same age as Source.

Source only manages it by keeping things as simple as possible - flat surfaces, so there's no distortion of the reflection to handle, and map brushes, so it's completely stationary and you don't need to worry about keeping track of the "virtual" camera position.
GORYGIRL1996 Jul 7, 2018 @ 5:17pm 
Originally posted by Zappy:
Originally posted by GORYGIRL1996:
- AWW DANG IT! THAT SUCKS! WHY IS IT THAT IT WORKS FOR MIRRORS IN MAPS BUT NOT MIRROR MODELS THAT'S NOT RIGHT. -
TECHNICALLY, IT DOESN'T WORK FOR "MIRRORS" IN MAPS, BUT RATHER "WATER" IN MAPS. AND IT DOESN'T WORK ON MODELS BECAUSE WATER REFLECTION ONLY WORKS ON MAP BRUSHES, AND SPECIFICALLY ONLY FLAT ONES.

EDIT: NOW THAT I THINK ABOUT IT, IT ALSO WORKS FOR ACTUAL NON-WATER MIRRORS IN MAPS (I THINK), BUT STILL ONLY ON FLAT SURFACES.
OH OK, WELL YA I HAVE SEEN REFELCTIONS IN GMOD MAP MIRRORS AND OTHER PLACES SO YA IK IT WORKS BUT IT STILL SUCKS THAT TI HAS TO BE SO TRICKY. XD

ALSO, ABOUT THE REFLECTION TINGS IN THE VMT FILE, WHAT SETTINGS WOULD I USE TO MAKE THEM LOOK RIGHT?

WHEN U MENTIONED THE

"$ENVMAP"

AND THE

"$ENVMAPTINT"

WHAT SETTINGS WOULD MAKE THE "REFLECTION" "WORK"/BRIGHTER
Last edited by GORYGIRL1996; Jul 7, 2018 @ 5:24pm
GORYGIRL1996 Jul 7, 2018 @ 5:18pm 
Originally posted by Marco Skoll:
Originally posted by GORYGIRL1996:
WHY IS IT THAT IT WORKS FOR MIRRORS IN MAPS BUT NOT MIRROR MODELS THAT'S NOT RIGHT.
Mirrors are actually a really difficult thing to handle in a game engine. The idea of having to handle light bounces massively complicates the maths involved.
Many engines can't handle it at all, particularly engines the same age as Source.

Source only manages it by keeping things as simple as possible - flat surfaces, so there's no distortion of the reflection to handle, and map brushes, so it's completely stationary and you don't need to worry about keeping track of the "virtual" camera position.
OK THANKS FOR THE INFO :D I'M SURE IT IS TRICKY SINCE MAPPING IN GENIRAL IS AHRD FOR ME XD.
episoder Jul 7, 2018 @ 5:57pm 
Originally posted by Marco Skoll:
Mirrors are actually a really difficult thing to handle in a game engine. The idea of having to handle light bounces massively complicates the maths involved.
Many engines can't handle it at all, particularly engines the same age as Source.

Source only manages it by keeping things as simple as possible - flat surfaces, so there's no distortion of the reflection to handle, and map brushes, so it's completely stationary and you don't need to worry about keeping track of the "virtual" camera position.

i've not seen a game engine that computes light bouncing of mirrors yet. for a simple mirror and one light it could be faked tho. it's just a light frustum. regular reflection sure is not that complicated. just the plane and the mirror frustum too. floors could be done easier. like unreal or frostbite or minecraft shaders. use an upside down framebuffer with fresnel. only works for somewhat 45 degrees tho. cause what's not vivsible does not reflect. glitchy if it's not combined with envmaps or realtime cubemaps or mirror scene rendering.
Expanix Jul 7, 2018 @ 6:53pm 
I KNOW THIS HAS NOTHING TO DO WITH THE TOPIC IN QUESTION, BUT WHAT'S UP WITH THE CAPITAL LETTERS? I FEEL LIKE YOU GUYS ARE SCREAMING AT EACH OTHER.

ALSO, HOW ABOUT MAKING THE MIRROR'S REFLECTING PART AN RT CAMERA? THAT COULD DO THE TRICK IF DETAIL IS NOT IMPORTANT IN THE REFLECTION.
Marco Skoll Jul 7, 2018 @ 7:05pm 
Originally posted by episoder:
i've not seen a game engine that computes light bouncing of mirrors yet.
When I say "light" I mean it in the sense of "light path" more than "light source". No, most game mirrors won't reflect light sources, but they are trying to simulate the reflection of a light path.

Obviously, an engine like Source normally handles lighting by calculating the relative angles between light source, the model face and the camera. While this is technically sort of a single light bounce of source -> object -> camera, the maths doesn't handle it that way, so there's no practical way to extend the normal graphical process to incorporate things reflecting in surfaces, meaning that mirrored surfaces have to be handled as a special case in the graphics - unlike in a path tracing render, where a mirrored surface is simply a different set of parameters to a wooden surface, but is otherwise processed by the render in an identical fashion.

This is why when you go into the toilets (or "washrooms", depending on your individual dialect of English) in most games, the mirrors that would be all but ubiquitous in the real world are either smashed or just slightly shiny grey surfaces with some hints of light/shadow painted on them.

Originally posted by Expanix #SaveEvolve:
I KNOW THIS HAS NOTHING TO DO WITH THE TOPIC IN QUESTION, BUT WHAT'S UP WITH THE CAPITAL LETTERS?
GoryGirl has eyesight problems and finds the shapes of capital letters easier to make out for a given font size.

(If I were behaving myself, I'd be converting my posts into capitals, but I'm not behaving myself right now... and if I try typing with caps lock on, i KEEP GETTING POSTS WHERE i CAN'T STOP MYSELF PUSHING sHIFT ALL THE TIME).

ALSO, HOW ABOUT MAKING THE MIRROR'S REFLECTING PART AN RT CAMERA? THAT COULD DO THE TRICK IF DETAIL IS NOT IMPORTANT IN THE REFLECTION.
I've already mentioned that, but it has a lot of limitations beyond merely detail (although you can turn up the resolution) - it's only okay-ish from certain angles if you want a good reflection.
Zappy Jul 8, 2018 @ 12:22am 
Originally posted by GORYGIRL1996:
- WHEN U MENTIONED THE "$ENVMAP" AND THE "$ENVMAPTINT" WHAT SETTINGS WOULD MAKE THE "REFLECTION" "WORK"/BRIGHTER
$ENVMAP CAN JUST BE SET TO A BRIGHTER CUBE-MAP TEXTURE, THOUGH AS YOU PROBABLY WANT IT TO REFLECT THE SURROUNDINGS SOMEWHAT, YOU HAVE TO USE "ENV_CUBEMAP" AS THE $ENVMAP TEXTURE, JUST AS YOU ARE ALREADY DOING.

KEEP IN MIND THAT EVEN THOUGH "ENV_CUBEMAP" REFLECTS THE SURROUNDINGS SOMEWHAT, THIS IS DONE BASED ON PRE-COMPILED ENVIRONMENT CUBE-MAPS OF THE MAP, SO IT WILL NOT REFLECT MODELS THAT YOU SPAWN YOURSELF OR ANYTHING LIKE THAT.


$ENVMAPTINT WORKS IN THE EXACT SAME WAY AS HOW I DESCRIBED $COLOR TO BE WORKING, EXCEPT FOR $ENVMAP INSTEAD OF $BASETEXTURE, WHERE YOU CAN USE A VALUE OF 0.5 FOR DARKER REFLECTIONS, 1 FOR NORMAL REFLECTIONS, 2 FOR BRIGHTER REFLECTIONS, AND SO ON.

YOU CURRENTLY HAVE IT SET TO 0.475, WHICH MAKES THE REFLECTIONS MUCH DARKER THAN NORMAL.
Last edited by Zappy; Jul 8, 2018 @ 12:25am
GORYGIRL1996 Jul 8, 2018 @ 6:36pm 
Originally posted by Zappy:
Originally posted by GORYGIRL1996:
- WHEN U MENTIONED THE "$ENVMAP" AND THE "$ENVMAPTINT" WHAT SETTINGS WOULD MAKE THE "REFLECTION" "WORK"/BRIGHTER
$ENVMAP CAN JUST BE SET TO A BRIGHTER CUBE-MAP TEXTURE, THOUGH AS YOU PROBABLY WANT IT TO REFLECT THE SURROUNDINGS SOMEWHAT, YOU HAVE TO USE "ENV_CUBEMAP" AS THE $ENVMAP TEXTURE, JUST AS YOU ARE ALREADY DOING.

KEEP IN MIND THAT EVEN THOUGH "ENV_CUBEMAP" REFLECTS THE SURROUNDINGS SOMEWHAT, THIS IS DONE BASED ON PRE-COMPILED ENVIRONMENT CUBE-MAPS OF THE MAP, SO IT WILL NOT REFLECT MODELS THAT YOU SPAWN YOURSELF OR ANYTHING LIKE THAT.


$ENVMAPTINT WORKS IN THE EXACT SAME WAY AS HOW I DESCRIBED $COLOR TO BE WORKING, EXCEPT FOR $ENVMAP INSTEAD OF $BASETEXTURE, WHERE YOU CAN USE A VALUE OF 0.5 FOR DARKER REFLECTIONS, 1 FOR NORMAL REFLECTIONS, 2 FOR BRIGHTER REFLECTIONS, AND SO ON.

YOU CURRENTLY HAVE IT SET TO 0.475, WHICH MAKES THE REFLECTIONS MUCH DARKER THAN NORMAL.

OK THANKS, I'LL TRY THAT, THANK U! THAT HELPS. ^_^ :D AND SO, DO I USE 2 FOR THE FIRST ONE I ASKED ABOUT TO? THE "CUBE MAP" ONE?
Last edited by GORYGIRL1996; Jul 8, 2018 @ 6:42pm
Zappy Jul 9, 2018 @ 4:29am 
Originally posted by GORYGIRL1996:
- DO I USE 2 FOR THE FIRST ONE I ASKED ABOUT TO? THE "CUBE MAP" ONE?
...WHAT WAS "THE FIRST ONE YOU ASKED ABOUT"? "THE CUBE-MAP ONE" IS SOMEWHAT VAGUE/UNSPECIFIC WHEN HAVING TALKED A LOT ABOUT CUBE-MAPS.

IF YOU'RE TALKING ABOUT $ENVMAPTINT, THEN TRY SETTING IT TO 1 FIRST, THEN JUST ADJUST IT AFTERWARDS IF IT'S TOO DARK OR TOO BRIGHT.
GORYGIRL1996 Jul 9, 2018 @ 1:15pm 
Originally posted by Zappy:
Originally posted by GORYGIRL1996:
- DO I USE 2 FOR THE FIRST ONE I ASKED ABOUT TO? THE "CUBE MAP" ONE?
...WHAT WAS "THE FIRST ONE YOU ASKED ABOUT"? "THE CUBE-MAP ONE" IS SOMEWHAT VAGUE/UNSPECIFIC WHEN HAVING TALKED A LOT ABOUT CUBE-MAPS.

IF YOU'RE TALKING ABOUT $ENVMAPTINT, THEN TRY SETTING IT TO 1 FIRST, THEN JUST ADJUST IT AFTERWARDS IF IT'S TOO DARK OR TOO BRIGHT.
I WAS REFERRING TO THE CUBE MAP ONE YES, UT THANKS FOR THOSE ANSWERS I WOULD LIKE TO NOW ABOUT THE CUBE MAP BUT IT DOSE'NT MATTER NOT A BIG DEAL
< >
Showing 1-15 of 15 comments
Per page: 1530 50

Date Posted: Jul 6, 2018 @ 9:16pm
Posts: 15