by date
Reworking TSE's sky object
Reworking TSE's sky object
| Name: | Alex Huck | ![]() |
|---|---|---|
| Date Posted: | Nov 26, 2006 | |
| Rating: | 4.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Alex Huck |
Blog post
My first .plan:
As a project to help me learn TSE, I'm going to try my luck at integrating a new sky system for TSE Here is my .plan outline:
Rework the sky code making it more shader optimized
Goals: Removal of un-animated "Painted on" clouds and backgrounds
Attributes of this sky
baseColor, I'm contemplating letting it be simply a variable I can edit, or maybe a black to blue color fade,
which has its value determined by the azimuth and zenith of the sun in the game.
Stars
Glowing glitter shader (Glow is done and so is glitter, now to add x+y)
clouds
I'm modeling this after what this genius did: www.youtube.com/watch?v=uH5dvO8kHRc.
I'm thinking of some kind of noise generation, that does it based on some sort of formula, that with a few
variable changes will generate a more swirling like pattern, like seen in that video, with the wind making it
swirl, and create small fragments here and there.
planets
Contemplating how I'll do this, an Image billboard seems archaic
Sun
HDR, I'm also thinking about adding that stange effect, where when you stare directly at the sun it
appears to flicker, flickering kind of dark. (Yes, I have actually stared at the sun briefly, to plan how I'd do it
in Torque Shader Engine)
Hopefully I can do this task, and if not hopefully I'll learn something trying. Feedback is very welcome.
As a project to help me learn TSE, I'm going to try my luck at integrating a new sky system for TSE Here is my .plan outline:
Rework the sky code making it more shader optimized
Goals: Removal of un-animated "Painted on" clouds and backgrounds
Attributes of this sky
baseColor, I'm contemplating letting it be simply a variable I can edit, or maybe a black to blue color fade,
which has its value determined by the azimuth and zenith of the sun in the game.
Stars
Glowing glitter shader (Glow is done and so is glitter, now to add x+y)
clouds
I'm modeling this after what this genius did: www.youtube.com/watch?v=uH5dvO8kHRc.
I'm thinking of some kind of noise generation, that does it based on some sort of formula, that with a few
variable changes will generate a more swirling like pattern, like seen in that video, with the wind making it
swirl, and create small fragments here and there.
planets
Contemplating how I'll do this, an Image billboard seems archaic
Sun
HDR, I'm also thinking about adding that stange effect, where when you stare directly at the sun it
appears to flicker, flickering kind of dark. (Yes, I have actually stared at the sun briefly, to plan how I'd do it
in Torque Shader Engine)
Hopefully I can do this task, and if not hopefully I'll learn something trying. Feedback is very welcome.
Recent Blog Posts
| List: | 12/13/06 - A hello to the world of character modelling 11/26/06 - Reworking TSE's sky object |
|---|
Submit your own resources!| Bryan Stroebel (Nov 26, 2006 at 03:38 GMT) |
| Edward Smith (Nov 26, 2006 at 03:47 GMT) Resource Rating: 5 |
Will the clouds have depth to them?
| Florian (Nov 26, 2006 at 11:50 GMT) |
| Alex Huck (Nov 26, 2006 at 18:58 GMT) |
In other words, don't get your hopes up :)
I'd rate my TorqueScript skill from 1-10 As 7.5, I've been using it through Tribes-Tribes2-Torque, and have gained lots of experiece with it, but I still do some stupid things with it (See my original "Round a number resource" :D)
C++ Skill 1-10 is around 3.5. I just started it about a month ago, with 0 previous experience I was first introduced to it through Torque, not a very good first lesson :P ( I also poked around a few guides, which is why it's 3.5 not 0)
So doing this all through script would be inefficient, and C++ probably very challenging, but We'll see how it goes....
On a side note, the HDR (As mentioned in my Sun section) is already in TSE, I thought I erased that before posting the .plan..
-edit- Another side nore where I said "I'm modeling this after what this genius did:" I made 'genius' sound perhaps sarcastic, just want to clarify that it's not sarcasm
Edited on Nov 26, 2006 19:00 GMT
| Alex Huck (Nov 26, 2006 at 19:49 GMT) |
Another method I had in mind was studying the Volumetric Fog code in Sky.cpp and making it so it only showed up in the sky, and had many holes in it, and a more cloud like shape
Also, in other news on my progress I learned that a shader cannot be applied to a skybox texture... making glitter shader stars more difficult than I hoped :(
Shaderized skyboxes could be awesome, anyone play Half-life2 Episode one,
*Possible Spoilers below*
/*
I'm not sure how they did the smoke above the citadel, it looked a lot like a relief/normal mapped/animated skybox. But it looked great, it had an interesting sence of enormous size, yet it had a scale that made you feel it was in the distance, very well made...
*/
*spoiler end*
But anyway, I would think the sky box in TSE did have a shader based texture, it had a "Glow" thing, but for the whole sky, not just stars as I'm hoping.
-edit- clarification
Edited on Nov 26, 2006 19:52 GMT
| Alex Huck (Nov 26, 2006 at 20:34 GMT) |
When I look in almost every hlsl file, they have something called TEXCOORD#,
Is this saying that when I make my CustomMaterial, and I have the texture array, that looks something like this
datablock CustomMaterial(MyMat)
{
texture[0] = "Some jpg or png";
texture[1] = "Some jpg or png";
texture[2] = "Some jpg or png";
texture[3] = "Some jpg or png";
}
is texture[0] passed into the hlsl file as TEXCOORD0, and texture[1] as TEXCOORD1, and so on?
-edit- Hmm, I guess not, on further inspection they have "pos = TEXCOORD#", and position has nothing to do with textures mapped on a surface
-edit2- Can someone please Nutshell-ize what I have to do to pass information to and from hlsl to the MaterialData? I see texCoord, which I assume means Texture Coordinates, but they don't always seem to equal a texture coordinate, sometimes it equals a pos (Position I assume)
-edit3 big edit- I think I really figured it out now, the way the texture array from the MaterialData communicates with the hlhs is in the "S" registers, texture[0] = register(S0);, texture[1] = register(S1); I think I'm very sure I've figured that out, meaning my fun with shaders will really take a jolt forward, now to mess with these: msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/dx9_graphic...
and see what madness I can come up with
Edited on Nov 26, 2006 21:17 GMT
| Stefan Lundmark (Nov 27, 2006 at 06:18 GMT) |
A good example of such data sent is sun position used for lighting.
Edit: Btw, that's one heck of a cute animal in your profile picture.
Edited on Nov 27, 2006 06:18 GMT
| Alex Huck (Dec 14, 2006 at 18:21 GMT) |
@stefan, Yep it's my pet Hedgehog aptly named 'potato'
@all again, Cloud shader development news: Video of what I have so far for a cloud layer, video shows it with normal colors but sped up a lot, then I proceed to change speed and later darkness variables:
www.youtube.com/watch?v=KmHMAfpgnfE
^Now to import as a cloud layer (Difficult), make transparent (Little difficult), and make it like a waterblock, where you can specify weight(Darkness) and Turbulence(Speed) right in the editor, just like you would change clarity or Fresnel bias in a TSE Waterblock, after that it should for the most part be done, then I have to do stars, glitter shader + skybox texture (Difficult, as skybox textures wont allow you to just drop a shader on it) Planets and sun are already in the engine as-is, but I'll see what I can do to improve what's already there
Base color is also already in, so that leaves these clouds, and stars
Big note: The shader was made using a modified Rendermonkey shader, not sure if that will have any legal issues, will have to take some(long) time to read the tome that is the EULA
Edited on Dec 14, 2006 23:12 GMT
| Alex Huck (Dec 16, 2006 at 00:51 GMT) |
This taken from Rendermonkey 1.62, fabric.rfx:
// Returns a 3d grid pattern
float pattern(float3 pos, float freq){
float3 fp = frac(pos * freq);
fp *= (1 - fp);
return dot(fp, 1);
}
pattern(pos + 120 * tex3D(Texture, pos).r, freq) * scale;
Copyright 2003, ATI Technologies
Ok, so the tex3D must explain how it goes into the function as a texture, (Texture variable is a sampler inputed into it)
However, once pattern does its thing on the tex3D, it returns a number, not a tex3D. Hmm, but that's besides the point I think the real question is, is how did a tex3d enter the function as a float3 (the variable 'pos') to begin with, how can a set of 3 float numbers tell pattern() all the pixel/color coordinates of the sampler it has to modify.... Anyway digressing back to the patterns output, a single number, dot(fp,1), that is beyond my comprehension too, how can a single number tell it what the output pattern will look like... My mind is melting.
[homer]Hmm, this [shader] stuff is hard, I think I'll order a Tab[/homer]
Edited on Dec 16, 2006 01:04 GMT
| JoZ (Feb 18, 2008 at 22:49 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



4.0 out of 5


