Shaders for planets

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Shaders for planets

Post by Frame »

The ability to put shaders on planets

Because this would simply be cool....

Captured from render monkey...

Image

Edit, forgot to mention to people who does not have much insight into shaders, that these lights come on as the planets surface come into the nightside of the planet...

if you download rendermonkey from AMD/ATI, and load the earth example.. you can see the effect...

Edit: addtional effects could be to make the planets surface somewhat dynamic... for instance gas gaints with moving clouds.. and so on... or wobbely surface... i wish i could show you an example of what i mean.. but like this..

Code: Select all

struct appdata 
{
	float4 position : POSITION;
	float4 color	: COLOR0;
	float3 wave	: COLOR1;
};

struct vfconn
{
	float4 HPos	: POSITION;
	float4 Col0	: COLOR0;
};

vfconn main(appdata IN,	uniform float4x4 ModelViewProj)
{
	vfconn OUT;			// Variable to handle our output from the vertex
					// shader (goes to a fragment shader if available).

	// Change The Y Position Of The Vertex Based On Sine Waves
	IN.position.y = ( sin(IN.wave.x + (IN.position.x / 5.0) ) + sin(IN.wave.x + (IN.position.z / 4.0) ) ) * 2.5f;
	
	// Transform The Vertex Position Into Homogenous Clip-Space (Required)
	OUT.HPos = mul(ModelViewProj, IN.position);

	// Set The Color To The Value Specified In IN.color
	OUT.Col0.xyz = IN.color.xyz;

	return OUT;
}
While this is used on a plane surface it would produce a wave effect... it could be transfered (i hope) to a planet surface... to wobble it giving it the appearence of a rising/sinking cloud deck
Bounty Scanner
Number 935
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

Would be indeed cool. It would help bring System Redux and Famous planets to bring graphics to the next level.

Aren't the SR planets a shell around the inner planet? So I assume it should be do-able. :?:
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
FSOneblin
---- E L I T E ----
---- E L I T E ----
Posts: 460
Joined: Tue Oct 30, 2007 12:15 am
Location: Yes, That is True

Post by FSOneblin »

:shock: :mrgreen: Wow, mr. green is right. Well, now I have the same problem as the TGHC (did I get the name right?) and commander H.

FSOneblin
Don't panic

Now an "adult!"
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Shaders on planets? Gosh, I never thought of that. :-p

The basic problem here is that the planet drawing code is very, very closely tied into the old texture system (which is now only used for planets). I tried hacking it to use the material system last week, but failed miserably. I definitely want to do this, but it may require rewriting planets completely, which isn’t a priority (i.e., I want to focus my limited Oolite-hacking energy on getting something releaseable).
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Frame, if you don't mind i'm going to nab your code example above and make a wavy flag out of it, then i'm going to claim all the asteroids for the Empire of Griff !
Image

If you do get shaders working on planets Ahruman, i think i might do a backflip in joy. Actually thinking about it, there's nothing stopping us from applying some of these shaders to Asteroids, OK, they're not all big like a planet, but they are mostly round and spinny, maybe we could do iceteroids or asteroids with glowy radioactive crystals/lava rivers etc on them and stuff? *mouth waters over teh graffix possibilities*
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Griff wrote:
Frame, if you don't mind i'm going to nab your code example above and make a wavy flag out of it, then i'm going to claim all the asteroids for the Empire of Griff !
Image

If you do get shaders working on planets Ahruman, i think i might do a backflip in joy. Actually thinking about it, there's nothing stopping us from applying some of these shaders to Asteroids, OK, they're not all big like a planet, but they are mostly round and spinny, maybe we could do iceteroids or asteroids with glowy radioactive crystals/lava rivers etc on them and stuff? *mouth waters over teh graffix possibilities*
its cool, i napped it myself from Nehe´s lesson 48 47..
that deals with vertex shaders

Edit: but wavy flags in space ^^... oh well lets say it is the "sun wind"... ^^
Bounty Scanner
Number 935
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Frame wrote:
Edit: but wavy flags in space ^^
Just like in real life, you mean?
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Ahruman wrote:
Frame wrote:
Edit: but wavy flags in space ^^
Just like in real life, you mean?
yeah, i know that, but it does not move/wave

it is just extended by a rod, running from the top of the pole to the
top left corner of the flag...

Using the above code with the same speed would wave it quite a lot...
Bounty Scanner
Number 935
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

*must* be strong wind out there, it's blown his umrella on the car inside out.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Killer Wolf wrote:
*must* be strong wind out there, it's blown his umrella on the car inside out.
:D :D :D

And don't forget the rain, making the umbrella a necessity in the first place (although I wonder why only the car has got one, not the guy).

So we conclude: The weather conditions on the moon are quite terrible. A little like in England, in fact. :wink:
Ahab
Harmless
Harmless
Posts: 1
Joined: Sun Nov 30, 2008 1:02 am

Post by Ahab »

Hmmm. OK this is my first post having discovered Oolite a week ago, so I have to say : Thanks! This game was a work of pure genius from its inception, and to think you can fit the whole universe into 32K :) Finding it here, now, after all this time, for free, with all these extra features... an absolute joy.

So, having experimented with modifying some oxp's, the system redux in particular, I'm doing the obvious thing in expanding it to give the systems outer gas giants and inner planets, with or without moons, and textured mostly thanks to NASA's cylindrical maps (some of which are already there in system redux).

Now, yes, I'd *like* to see the cities light up on the night side of my inhabited worlds.... Sadly, I know nothing of modern computer graphics, but a cursory read of some Wiki's mentioning 'pixel shaders' keeps my hopes up for the idea I had in mind...

Could the GPU be instructed simply to colour any pixel in the (visible part of) the texture white if say it's colour code has all three RGB least significant bits set? That would take a little doctoring of the texture files, but zeroing the least significant bit of each pixel ought not to affect the image very much...

All those little points of light would make such a difference :)

While I am here, two more things :- (i)(a) Can I put a texture on the Sun? (b) Any chance of binary star systems? and (ii) My secondary planets are refusing to rotate :( - they appear to rotate in wireframe mode, but the textured versions are not moving :(
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Solar Systems oxping ...

Post by Lestradae »

Hi Ahab!
Ahab wrote:
So, having experimented with modifying some oxp's, the system redux in particular, I'm doing the obvious thing in expanding it to give the systems outer gas giants and inner planets, with or without moons, and textured mostly thanks to NASA's cylindrical maps (some of which are already there in system redux).
You really should have a look at this thread here:

https://bb.oolite.space/viewtopic.php?t=4578

... and get in touch with the users Frame and Dr Beeb - they have been doing work on exactly the same topic.

Would love to have an oxp that creates full-blown solar systems with convincing distances, had a go at it myself, but my scripting just isn`t up to it.

8)

L
Post Reply