Garry's Mod

Garry's Mod

29 ratings
CMST: Cubemap switcher or Responsive cubemaps
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Scenic
File Size
Posted
Updated
17.786 KB
14 Dec, 2022 @ 11:22am
22 Dec, 2022 @ 7:49am
4 Change Notes ( view )

Subscribe to download
CMST: Cubemap switcher or Responsive cubemaps

Description
Requires Referenced map files listener addon to work!


MAP BSP MUST BE INSTALLED IN ORDER FOR THIS TO WORK
(IN OTHER WORDS: MAP BSP MUST BE IN YOUR MAPS FOLDER)



What is this?

Cubemap switcher is an addon that allows you to create function for your map, that dynamically switches cubemaps then light entities toggle on and off.
This is a tool for map makers.

How to use it?

You can follow in-game guide by typing "cubemap_switcher_help" into console or follow a guide below
Before you continue, see method below this one and choose the best from these for your map.

Method 1

To begin, start new game on your map, then..
Step 1: Turn off all the lights.
You must turn off all switchable lights on your map, use 'cubemap_switcher_turnlights 0' to do this
Step 2: Bake unlit cubemaps.
Bake your cubemaps now, use 'buildcubemaps'
Step 3: Extract unlit cubemaps.
Extract your cubemaps, use 'cubemap_switcher_writecubemaps' and follow instructions written in the chat after it finishes extraction. Your game mast be un-paused.
Step 4: Bake default cubemaps.
Restart the map, then turn on all switchable lights on your map, use 'cubemap_switcher_turnlights 1' to do this. Then bake cubemaps, use 'buildcubemaps'.
Step 5: Get the function.
Restart the map again and then use 'cubemap_switcher_getfunction'(you can add 1 as an argument here if you're sure the map you're working on is going to be played only then CMST installed, otherwise, if you'll leave this argument blank, you'll get a standalone function*) and follow instructions written in the chat after it finishes.
Don't forget to restart your game after all this.
After you've done everything, your map will NOT require this addon to be installed and required addon for this addon*.

"Props still shine like sun then lights turn off"

Unfortunately, CMST can't change envmap lightning on props and other non-brush entities. BUT... you can use next method to kinda get around this restriction.

Method 2

In this method you'll need to bake cubemaps(for your final map, not the function) while all lights are turned off.
The game will render unlit cubemaps on all props and other non-brush entities.

If your cubemaps aren't already baked with all lights turned on(They most likely are baked lit so skip this maybe) then..
Step 1: Turn on all the lights.
You must turn on all switchable lights on your map, use 'cubemap_switcher_turnlights 1' to do this
Step 2: Bake lit cubemaps.
Bake your cubemaps now, use 'buildcubemaps'
Else skip these steps..

Step 3: Extract lit cubemaps.
Extract your cubemaps, use 'cubemap_switcher_writecubemaps' and follow instructions written in the chat after it finishes extraction. Your game mast be un-paused.

Step 4: Turn off all the lights.
Restart the map(If followed steps 1-2), then you must turn off all switchable lights on your map, use 'cubemap_switcher_turnlights 0' to do this
Step 5: Bake unlit cubemaps.
Bake your cubemaps now, use 'buildcubemaps', these must be your map's default cubemaps from now on

Step 6: Get inverted function.
Restart the map again and then use 'cubemap_switcher_getfunction_inverted' and follow instructions written in the chat after it finishes.
After you've done everything, your map will NOT require this addon to be installed and required addon for this addon*.

"Then i turn off lights, the cubemaps located on the other side of the map are changing, but i don't want them to"

You can change the table written in the function and assign some of the materials to another light or remove them from that table completely. You can also try to add another named light near the changing cubemap entity and redo the function(You won't need to follow the first steps in this case, just use 'cubemap_switcher_getfunction_*')

github https://github.com/Zack90-oss/CMST-Cubemap-switcher-or-Responsive-cubemaps

If you still have any questions, you can ask them in the discussions or in the comments
Popular Discussions View All (1)
4
23 Dec, 2022 @ 5:44am
Any questions?
Zac90
18 Comments
Breastie 2 Feb @ 1:43am 
Alright, tysm!
Zac90  [author] 2 Feb @ 12:21am 
were* written
Zac90  [author] 2 Feb @ 12:20am 
Yeah, I found the problem, instructions basically say
"Cubemaps was written into garrysmod/data/+cubemap_switcher/dc_<MAPNAME>"
"Move this folder into *youraddon*/materials/maps/"

I'll fix it later
Breastie 1 Feb @ 4:21pm 
The console says when it's done and where the vtfs are.
Breastie 1 Feb @ 4:14pm 
I did find the textures in this folder yeah. I just don't get instructions on what to do with these. I think everything else worked as expected.
Zac90  [author] 1 Feb @ 1:15pm 
and also try checking your data folder for "+cubemap_switcher" folder
Zac90  [author] 1 Feb @ 1:13pm 
Does it write anything to your console?
Breastie 1 Feb @ 3:31am 
Step 3 doesn't write to chat.
【R】【e】【d】【d】 19 Nov, 2024 @ 3:25pm 
I've been NEEDING this forever, thank you, gone are my days of having everything mounted but STILL HAVING ERRORED CUBEMAPS
HorrorPrune_Dream 19 Jun, 2024 @ 1:04pm 
I don't know how to do it.