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
10 Comments
【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.
kuzukuzu26 18 Oct, 2023 @ 3:28am 
rgergerge
kuzukuzu26 6 Oct, 2023 @ 11:39pm 
gggfngfn
useless 14 Feb, 2023 @ 8:02pm 
THIS IS SO HELPFUL FOR MAPPERS, YOU'RE A LIFESAVER!!!
shock23 3 Feb, 2023 @ 12:37am 
OMG so cool!11!!:steamhappy:
kuzukuzu26 17 Dec, 2022 @ 3:27am 
FDDFSSFS
Doctor Sex 15 Dec, 2022 @ 2:15am 
Omg Zac90 I'd my sugar daddy, 10/10 mod ☠️🧈🧈🧈:spiffo:
Yaher 15 Dec, 2022 @ 1:28am 
OMG i have been waiting for this for so many years!!!!:steamhappy:
Wuth 14 Dec, 2022 @ 6:54pm 
ok