Moving nightsky with clouds hemisphere

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
vedan77
Posts: 20
Joined: Fri Aug 20, 2021 5:09 am

Moving nightsky with clouds hemisphere

Post by vedan77 »

Hi,

for another approach to skyboxes, here's a SkyViewpoint in a hemisphere that has a moving night sky ceiling texture.

I added seven layers of 3d sectors with scrolling floors and transparent cloud textures. The textures themselves are quite big in their dimensions, but not in their file size.

There also is a blue additive light to compliment the colors of the sky texture (which is above the cloud layers).

The code is simple, scrolling speeds can be defined easily:

Code: Select all

#include "zcommon.acs"

script "sky" OPEN { // sky
	int skyspeed_x = 2;			// x scrolling speed of sky
	int skyspeed_y = 1;			// y scrolling speed of sky
	
	int minspeed_x = 1;			// x min scrolling speed of clouds
	int minspeed_y = 1;			// y min scrolling speed of clouds
	int maxspeed_x = 4;			// x max scrolling speed of clouds
	int maxspeed_y = 4;			// y max scrolling speed of clouds
	
	int cloudspeed_x = Random(minspeed_x, maxspeed_x);
	int cloudspeed_y = Random(minspeed_y, maxspeed_y);
	
	int scroll_start = 992;		// starting sector (clouds)
	int scroll_end   = 999;		// end sector (sky)
	
	while (scroll_start <= scroll_end) {
		if (scroll_start < 999) {
			Scroll_Floor(scroll_start, cloudspeed_x, cloudspeed_y, 0);
			cloudspeed_x = Random(minspeed_x, maxspeed_x);
			cloudspeed_y = Random(minspeed_y, maxspeed_y);
			scroll_start += 1;
		} else {
			Scroll_Ceiling(scroll_start, skyspeed_x, skyspeed_y, 0);
			break;
		}
	}
}
In a wide, open area, distant clouds look pretty much 2d.

If anybody got any ideas on how to improve this, don't hesitate^^

FILE DOWNLOAD ON MEDIAFIRE

Screenshots of second demo map

Last edited by vedan77 on Sun Sep 26, 2021 3:29 pm, edited 2 times in total.
User avatar
Enjay
 
 
Posts: 26540
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Moving nightsky with clouds hemisphere

Post by Enjay »

It's nice but the clouds look a bit flat/distorted to me.

Also, when running the test map I get:

Code: Select all

Runaway script "Sky" terminated
vedan77
Posts: 20
Joined: Fri Aug 20, 2021 5:09 am

Re: Moving nightsky with clouds hemisphere

Post by vedan77 »

Enjay wrote:It's nice but the clouds look a bit flat/distorted to me.
That's what it says in the description. Problem is, that I'd have to increase the size of the hemisphere by a nice amount. This would be no problem at all for x & y, but for z.

Then, the cloud layers could be far more higher. I'll try to work on that, but it's very tedious.

UPDATE: Added a second demo map with a bigger hemisphere, but clouds still look pretty 2d when far away.

Things to fiddle around with to customize it a little more:
- height of cloud textures
- texture scaling of cloud textures
Enjay wrote:Also, when running the test map I get:

Code: Select all

Runaway script "Sky" terminated
I inserted a "break;" for correctly ending the whlie loop, it shouldn't appear anymore.
User avatar
ramon.dexter
Posts: 1558
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Moving nightsky with clouds hemisphere

Post by ramon.dexter »

WHile loop needs to have a Delay(tics) inside, break; is for switches.

Return to “Tutorials”