Oolite Bulletins

For information and discussion about Oolite.
It is currently Tue May 23, 2017 8:41 pm

All times are UTC




Post new topic  Reply to topic  [ 405 posts ]  Go to page Previous 123 24 25 26 27 Next
Author Message
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Feb 13, 2012 9:36 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Griff posted an example here related to discussion in the Progress thread. That discussion and the example have been joined together in a new topic.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Feb 13, 2012 9:44 pm 
Online
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
User avatar

Joined: Sat Jul 04, 2009 9:31 pm
Posts: 12520
Location: Corke's Drift
Interesting new rank you have there, Ahruman... may I have one, please? Something like Decidedly Dodgy Assassin, maybe?

_________________
A squid eating dough in a polyethylene bag is fast and bulbous! Got me?


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Feb 13, 2012 9:47 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
I just moved an off-topic post out of here, you know, and it wasn’t even very off.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Wed Mar 07, 2012 10:42 pm 
Offline
Dangerous
Dangerous

Joined: Mon Jan 30, 2012 10:27 pm
Posts: 91
Location: UK
Hi guys.

Query: How do I define galaxyNumber as a uniform bind in shipdata.plist shaders please?

uniforms =
{
uColorMap = { type = texture; value = 0; };
uNormalMap = { type = texture; value = 1; };
uEffectsMap = { type = texture; value = 2; };
uTime = "universalTime";
uGalaxy = "galaxy_number";
};

... is what I've got in the code but doesn't appear to be correct. Getting [shader.uniform.unpermittedMethod]: Did not bind uniform "uGalaxy" to property -[ShipEntity galaxy_number] - unpermitted method.


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu Mar 08, 2012 7:52 am 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Thu Dec 14, 2006 9:08 am
Posts: 9520
Location: a Hacker Outpost in a moderately remote area
Looking at the rest of the syntax, have you tried "galaxyNumber" instead of "galaxy_number"?

_________________
The Story — The Career — The OXPs


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu Mar 08, 2012 10:54 am 
Offline
Dangerous
Dangerous

Joined: Mon Jan 30, 2012 10:27 pm
Posts: 91
Location: UK
Yep, had tried that previously with no luck also. According to the wiki ( http://wiki.alioth.net/index.php/Shader ... :_uniforms ) right down at the bottom "Additionally, all state query scripting methods ending with _number may be used for the player."

So maybe you can't bind it unless its a player object? :(

I'd like to be able to use it to offset a texture depending on which galaxy the player is in (the docking display screen in my beta TCA.oxp for additional broadcast arrays in other galaxy charts) rather than add like_ships for each chart relisting all the subentities from the template ship.


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu Mar 08, 2012 11:22 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
User avatar

Joined: Fri Nov 11, 2011 6:19 pm
Posts: 4005
Quote:
I'd like to be able to use it to offset a texture depending on which galaxy the player is in (the docking display screen in my beta TCA.oxp for additional broadcast arrays in other galaxy charts) rather than add like_ships for each chart relisting all the subentities from the template ship.
Looks like those are player only, yes. A slight hack: in their ship script, set their fuel levels to 0 -> 0.7 LY depending on galaxy, so the fuel uniform will then have the chart number from 0-7.

_________________
OXPs: [EliteWiki] New Cargoes, [EliteWiki] Skilled NPCs, [EliteWiki] Curse of the Black Sunspot, and more


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu Mar 08, 2012 12:09 pm 
Offline
Dangerous
Dangerous

Joined: Mon Jan 30, 2012 10:27 pm
Posts: 91
Location: UK
Thanks Cim, not got it working completely yet, but changing the fuel of the parent entity in the debug console changes the broadcast display on the fly now, so on the right track. :)


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Mar 12, 2012 1:18 pm 
Offline
Commodore
Commodore
User avatar

Joined: Thu Nov 10, 2011 7:49 am
Posts: 248
Please forgive a possibly very novice question. I have been experimenting with shaders by modifying ahruman's cube_map test shaders to use cube maps for all cases. Currently parallax mapping has me a bit stumped. Picking the value for the parallax offset from a cube map was simple enough - however , perturbing the 'real' cube texture coordinates based on the parallax value and the position of the camera is _almost_ working. The effect I see appears correct for some 'faces' of the cube texture, but inverted on other faces.
Code:
	// Get texture coords, using parallax mapping if appropriate
	//
	// float parallax = texture2D(uNormalMap, vTexCoord).a;
	float parallax = textureCube(uNormalMap, vCubeTexCoords).a ;
	parallax *= 0.02;
	vec3 ParallaxCubeTexCoords =  vCubeTexCoords + parallax * vEyeVector;

_________________
Povray Planets - Planet textures for your galaxy


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Mar 19, 2012 12:16 pm 
Offline
Dangerous
Dangerous

Joined: Mon Jan 30, 2012 10:27 pm
Posts: 91
Location: UK
I'm having trouble with getting uGalaxy (an int, passed as Fuel in Shipdata which is working fine as non-player entities cannot pass galaxyNumber) used to multiply the offset Y-coordinate of a texture. People with older versions of OpenGL are getting error messages about trying to multiply an int with a float. :(

I'm currently trying to create a float offsetY variable as a float based on the value of uGalaxy and use that instead (relevant code pieces):
Code:
uniform int	uGalaxy;
const float offsetY = 0.0;

#ifndef OO_REDUCED_COMPLEXITY
	if(uGalaxy==1){offsetY=0.125;}
	if(uGalaxy==2){offsetY=0.25;}
	if(uGalaxy==3){offsetY=0.375;}
	if(uGalaxy==4){offsetY=0.5;}
	if(uGalaxy==5){offsetY=0.625;}
	if(uGalaxy==6){offsetY=0.75;}
	if(uGalaxy==7){offsetY=0.875;}
#endif
but I'm getting 'if' syntax errors for this. I'm pretty new to programming and so may have the format of the conditional statement wrong but googling so far has not turned up any fixes for me. Help would be appreciated!


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Mar 19, 2012 12:35 pm 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
User avatar

Joined: Fri Nov 11, 2011 6:19 pm
Posts: 4005
I think you should be able to do:
Code:
uniform int uGalaxy;
float fGalaxy = float(uGalaxy);
to convert the type, and go from there.

_________________
OXPs: [EliteWiki] New Cargoes, [EliteWiki] Skilled NPCs, [EliteWiki] Curse of the Black Sunspot, and more


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Mar 19, 2012 2:47 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Thu Dec 14, 2006 9:08 am
Posts: 9520
Location: a Hacker Outpost in a moderately remote area
Quote:
I think you should be able to do:
Code:
uniform int uGalaxy;
float fGalaxy = float(uGalaxy);
to convert the type, and go from there.
That seems to do the trick for me. I have no errors in the log and see the Snoopers message.

_________________
The Story — The Career — The OXPs


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Mar 19, 2012 6:29 pm 
Offline
Dangerous
Dangerous

Joined: Mon Jan 30, 2012 10:27 pm
Posts: 91
Location: UK
Thanks cim, knew that there was probably an easy way to do it :)


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Sun Apr 22, 2012 9:18 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2259
Location: Wales
From lusting after the lovely planet screenshots going up in the 'progress' thread i dug out the old Earth example shader (based on the example shader in ATI's Rendermonkey) and added in a small rim light atmosphere effect i pinched off a shader tutorial website
Image
Image
I couldn't find where the old oxp was stored so i've uploaded it again
https://www.box.com/s/8a7b8a4ba5cc6103366e
it just adds some big asteroids textured to look like Earth outside the station when the player launches so they'll be spinning around in all sorts of odd directions :lol:

_________________
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Sun Apr 22, 2012 11:03 pm 
Online
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
User avatar

Joined: Sat Jul 04, 2009 9:31 pm
Posts: 12520
Location: Corke's Drift
Rather good fun, blowing multiple mini-Earths to pieces. They do look nice, though!

_________________
A squid eating dough in a polyethylene bag is fast and bulbous! Got me?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 405 posts ]  Go to page Previous 123 24 25 26 27 Next

All times are UTC


Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited