ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Cube maps in STALKER

1 2 3 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  04:02:45  19 March 2013
profilee-mailreply Message URLTo the Top
Millenia
(Senior)
 
On forum: 04/04/2007
Messages: 130
Cube maps in STALKER

Anyone got insight on how these work? I noticed the #small sky cubes apply a nice cubemap reflection which is what I was after, but the effect doesn't seem to be maskable.

Alternatively, I'd love to apply the cubemap to just, say, the weapon.

http://puu.sh/2kbBX

Left example has a custom #small cubemap.
  05:05:02  19 March 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
 

Message edited by:
Jketiynu
03/19/2013 5:28:14
Messages: 867

---QUOTATION---
Cube maps in STALKER

Anyone got insight on how these work? I noticed the #small sky cubes apply a nice cubemap reflection which is what I was after, but the effect doesn't seem to be maskable.

Alternatively, I'd love to apply the cubemap to just, say, the weapon.

http://puu.sh/2kbBX

Left example has a custom #small cubemap.
---END QUOTATION---



If you tell me how you went about applying the cubemap to the weapon maybe I can help.

Did you use the #small cubemap renamed as weaponname_bump# or did you do something else? Once I understand how you apply it I can experiment in the SDK to see how to make it only happen to the weapon.

Alternatively, you could ask someone such as Meltac to create a new model_shader.s file that does a cubemap reflection and that alone. It shouldn't be too hard to do.
Hell, I may even be able to do it. Then you'd just apply that shader to the weapon skin instead of models_weapons, etc.

*Final edit*
Looks like Call of Pripyat does this already.

You'll need to change the models/weapons in shaders.xr via the Shader editor in the SDK and fill it out with the following info (assuming the SOC SDK has these options):

Environment map:
Name - sky\sky_cube_weapons (here's the texture for it: http://www.sendspace.com/file/3x1ppj )
Transform - Custom

Custom Transform:
Mode - Cube Reflection
Alpha-Blend - Not used

If those options aren't present then I don't know what to say except ask again how you're currently applying the cube map?
  12:53:55  19 March 2013
profilee-mailreply Message URLTo the Top
Millenia
(Senior)
 
On forum: 04/04/2007
Messages: 130
I was just using #small maps for the env map which is not a very good solution. Using a models_weapons.s file seems to apply it to the weapon only (it won't apply it at all without this file), but it makes my guns transparent and seems to ignore normal/specular maps. Env/diffuse do appear.

function normal (shader, t_base, t_second, t_detail)
shader:begin ("model_env_lq","model_env_lq"
: fog (true)
: zb (true,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: sorting (3,true)
shader:sampler ("s_base" :texture (t_base)
shader:sampler ("s_env" :texture ("sky\\sky_cube_weapons" : clamp()
end
  15:47:04  19 March 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
 

Message edited by:
Jketiynu
03/19/2013 15:57:24
Messages: 867

---QUOTATION---
I was just using #small maps for the env map which is not a very good solution. Using a models_weapons.s file seems to apply it to the weapon only (it won't apply it at all without this file), but it makes my guns transparent and seems to ignore normal/specular maps. Env/diffuse do appear.

function normal (shader, t_base, t_second, t_detail)
shader:begin ("model_env_lq","model_env_lq"
: fog (true)
: zb (true,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: sorting (3,true)
shader:sampler ("s_base" :texture (t_base)
shader:sampler ("s_env" :texture ("sky\\sky_cube_weapons" : clamp()
end
---END QUOTATION---



I'm pretty sure I was wrong regarding using a .s file which is why I posted the changes you should make to shaders.xr (I'm positive that you have to do the changes there in the ways I mentioned).
Did you try modifying shaders.xr yet? It should not need a new corresponding .s file.

I'm almost positive that you do not need a new .s file because there are a bunch of shaders in shaders.xr which have no corresponding .s file or anything else in the unpacked shaders yet they're used by the game all the time.

*Edit*
If you don't know how to work with the shaders editor I'll install the SOC SDK real quick and do it for you and test it and make sure it's working.
  20:14:55  19 March 2013
profilee-mailreply Message URLTo the Top
Millenia
(Senior)
 
On forum: 04/04/2007
Messages: 130
I've tweaked the shaders in that, yeah. It's just that it doesn't use any cubemaps unless I make an .s file :I
  20:24:46  19 March 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
 

Message edited by:
Jketiynu
03/19/2013 20:25:09
Messages: 867

---QUOTATION---
I've tweaked the shaders in that, yeah. It's just that it doesn't use any cubemaps unless I make an .s file :I
---END QUOTATION---



Oh. That's strange. The commonly used models/weapons doesn't even have a corresponding .s file.

If I were you I'd ask Meltac for help.
  20:28:05  19 March 2013
profilee-mailreply Message URLTo the Top
Millenia
(Senior)
 
On forum: 04/04/2007
Messages: 130
Yeah, I sent him a message, hope he's not too busy.
  03:21:26  20 March 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
 

Message edited by:
Jketiynu
03/20/2013 3:21:47
Messages: 867

---QUOTATION---
Yeah, I sent him a message, hope he's not too busy.
---END QUOTATION---



If you do get a response if he helps would you mind sharing it?

I'm trying to add a custom shader into shaders.xr for scope lenses (I figure rather than the current method it would look better if a separate part was made for each scope lens, which would then have a different shader applied to it which would reflect the surrounding environment like what lots of games do) so his advice could be of use to me too, since I'm guessing I'd encounter the same problem you're encountering.
  11:31:32  20 March 2013
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
 

Message edited by:
Meltac
03/20/2013 11:35:32
Messages: 1519
Hey guys, I'd be eager to help here, but in order to do so I first have to fully understand what exactly is going on here.

I know *more or less* , but unfortunately not exactly what function the different "shader" components in X-Ray / SoC have, so if anyone could shed a little more light on how these parts exactly work together it would be very helpful to solve issues such as the above:

1. SDK / Shader Editor
2. shaders.xr
3. cube maps / textures
4. .s files
5. HLSL files (.vs Vertex and .ps Pixel Shaders)

Better knowledge of the function of those components within X-Ray's render pipeline would ultimately be of great help in such cases as yours.

EDIT:
I personally mainly have experiences with parts 4 and 5, so please don't ask me about SDK-related stuff.
  16:54:15  20 March 2013
profilee-mailreply Message URLTo the Top
Millenia
(Senior)
 
On forum: 04/04/2007
 

Message edited by:
Millenia
03/20/2013 16:55:49
Messages: 130
Well basically the first three parts work so that you assign a cubemap to a shader (in this case models/weapons), then assign that shader to a model (all vanilla weapons have that shader already). By default, it should call textures/sky/sky_cube_weapons.dds, and this effect is masked with the weapon texture's alpha map (black is full reflection, white is zero reflection).

Unfortunately, in the vanilla game, weapon cubemaps only work in DX8 mode. Making a new .s file and assigning the cubemap there like in my example would fix it, but this (at the moment) seems to make the weapon transparent as well (probably because I have no idea what I'm doing with s/vs/ps files). I think it would only be a case of locating the right functions in said files and assigning those to models_weapons.s.

PS. thanks for your attention Meltac, I'm experienced in 3d stuff but utterly clueless when it comes to shader code
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.