Garux / netradiant-custom

The open-source, cross-platform level editor for id Tech based games.
https://garux.github.io/NRC/
Other
301 stars 52 forks source link

Feature Request: Show skybox cubemap. #96

Open stoofphen opened 2 years ago

stoofphen commented 2 years ago

Basically the feature in JACKHAMMER / CoD2Radiant / CoD4Radiant, which reads the sky shaders in the editor and projects them as a cubemap as they would be seen in-game. It's kind of a minor cosmetic, but I feel it adds nicely to the editor and mapping experience of being able to visualise the selected skybox. If you are to investigate this (would be most appreciative!) bonus points if you can also somehow get it to render the props_skyportal / misc_skyportal entities as well! (maybe even the q3map2 _skybox entity which visualises 'scaled' geometry).

As a side note of appreciation; Thank you for developing such a robust Radiant! I've been using basically all variations of Radiant under the sun since around 2007, this by far is the most cleanest and reliable one I have used, and most versatile as well. I honestly cannot use another editor without feeling that same sense of competency and comfort as I do with Radiant.

(Examples below)

image image

Garux commented 2 years ago

Thank you. Atm I'm in creation of huge skies pack for mapping and got feeling that this would be worthy, at least for previewing boxes. How drawing sky brushes is organized in these examples? If rendering box in a classic way, rendering brushes is questionable.

stoofphen commented 2 years ago

Indeed, would definitely assist with checking the cubemap quickly in editor when creating them, rather than having to compile the map and running the game to see it..

In terms of the technical details of how this may be handled - I am not really an expert on this. I have provided more context on usage below, if that is of any use.

For CoD2 radiant, it renders the cubemap as part of the brush you assign the texture to. Interestingly, allows for multiple different skies to be rendered (with obviously one taking precedence over the others if viewed overlapped).

https://user-images.githubusercontent.com/100675382/156715056-5c03906a-7c38-409b-8858-a25996799ad4.mp4

.

Whereas for J.A.C.K. - in the context of Gold Source, you input the cl_skyname variable for the env cubemap name in GFX (corresponding _ft, _lf, _rt etc images) and it renders over the SKY texture, similar to CoD2 Radiant's. image

Do you think such a thing would be easy or difficult to implement in terms of having a brush with the 'surfaceparm sky' render the corresponding 'skyParms' cubemap as part of the actual brush geometry itself?

Otherwise, maybe a fallback would be to render a cubemap as part of the 3D camera background, associated with path to the cubemap images?

Food for thought.

Garux commented 2 years ago

Rendering part of cubemap looks optimal in terms of features, idk how messy is implementing this, at least is not super trivial.

ensiform commented 2 years ago

How would it work when differentiating between shader usage for Quake 3 engines vs no shader for legacy engines? Not to mention mtr for tech4 if supported.

Garux commented 2 years ago

It wont, would need to render sky box, as in engine (speaking of case, when sky is defined by some key, right?). Pros of rendering part of cubemap at a polygon for shader way:

Garux commented 1 year ago

Added Q3 skyboxes rendering like in CoD2 https://github.com/Garux/netradiant-custom/commit/d3e48d8c31ddd5e1996570ba53f0321d65155d17. Rendering cloud layers boils down to reimplementation of Q3 shaders parser and its renderer (done in JACK). Getting _skybox geometry requires bsp building (thing not to do in runtime). Most doable of these look entity defined skyboxes, require special observer for them and special rendering code.

stoofphen commented 1 year ago

Been a while since this post, however just wanted to say a big thank-you for implementing this! Really makes the adjustment of the the _sun light angle to match the skybox much easier too!

Understanding _skybox is part of the bsp build, however I am aware that the Star Trek Elite Force II UberRadiant (part of STEF2 UberTools GDK) has capability to render the skyportal geometry, which I think you could offset its movement based on the 3D camera view, relative to the origin of the world (0,0,0) which is scaled by the skyportal 'scale' factor.

In UberRadiant, set up is basically create a script_skyorigin entity (much akin to the misc_skyportal / props_skyportal) and 'F10' enables the Skyportal view as the 3D camera background. This is refreshed to take whatever the visible state of the map is, so you can see I've hidden some walls which make it hidden in the 3D camera background accordingly.

image

image

If you are interested, you can test for yourself. https://www.moddb.com/games/star-trek-elite-force-ii/downloads/stef2-bertools-game-devolopment-kit