Version 0.320 - ship rendering, lighting and shaders
Moderator: Committer
Version 0.320 - ship rendering, lighting and shaders
Version 0.320 issues go here!
Re: Version 0.320 - ship rendering, lighting and shaders
Here is a mockup breaking down the lighting and shader.
Lighting:
We are using a 2 point setup, it's simple and effective. This means there is a key light and an opposing fill light. The star is always the key light.
A fill light helps to define the forms, adds mood and helps to integrate the object in its environment. Unlike the key light, there can't be a single fill light, that works for every ship, because where the fill light is positioned depends on the position of the ship in relation to the star. So every ship need's it's own fill light. I'm not sure how you would approach this situation in Ogre, but I can think of two scenarios:
1. every ship get's it's own fill light, that only affects this very ship, and no other game object
2. a shader effect, that simulates a fill light, depending on the shading done by the key light(maybe somehow inverting it?)
Just brightening the shadow side with a color(=ambient light) should be avoided, because it flattens out the form and generally looks bad.
The color of the fill light should be defined using an external text file, probably in the same folder as the skybox textures, because it will be based on the dominating color in each of the skybox texture sets(they will be monochromatic mostly).
Shader:
Four texture maps are used: a color map, a specular map, a glow map and a normal bump map. The mockup shows how each map would look when applied exclusively(using a 50% grey as color).
If you could write a shader, that also supports a transparency map in addition to the other 4 maps, that would be a bonus.
Here's is also a mockup how this should look ingame, when everything is done correctly(scale exaggerated):
Lighting:
We are using a 2 point setup, it's simple and effective. This means there is a key light and an opposing fill light. The star is always the key light.
A fill light helps to define the forms, adds mood and helps to integrate the object in its environment. Unlike the key light, there can't be a single fill light, that works for every ship, because where the fill light is positioned depends on the position of the ship in relation to the star. So every ship need's it's own fill light. I'm not sure how you would approach this situation in Ogre, but I can think of two scenarios:
1. every ship get's it's own fill light, that only affects this very ship, and no other game object
2. a shader effect, that simulates a fill light, depending on the shading done by the key light(maybe somehow inverting it?)
Just brightening the shadow side with a color(=ambient light) should be avoided, because it flattens out the form and generally looks bad.
The color of the fill light should be defined using an external text file, probably in the same folder as the skybox textures, because it will be based on the dominating color in each of the skybox texture sets(they will be monochromatic mostly).
Shader:
Four texture maps are used: a color map, a specular map, a glow map and a normal bump map. The mockup shows how each map would look when applied exclusively(using a 50% grey as color).
If you could write a shader, that also supports a transparency map in addition to the other 4 maps, that would be a bonus.
Here's is also a mockup how this should look ingame, when everything is done correctly(scale exaggerated):
Re: Version 0.320 - ship rendering, lighting and shaders
pd as we chatted, i commit you now a basic .material file setting up the shader.
you wanted to set up the shader.
all you have to do is to implement multitexturing, the first map is already implemented.
look here:
it shows the "guardian_normal" texture.
i commit you the files so that you can compile fo to try out editing the .material file.
you wanted to set up the shader.
all you have to do is to implement multitexturing, the first map is already implemented.
look here:
it shows the "guardian_normal" texture.
i commit you the files so that you can compile fo to try out editing the .material file.
- Attachments
-
- Combat.tar.gz
- the combat files
- (18.24 KiB) Downloaded 118 times
Re: Version 0.320 - ship rendering, lighting and shaders
You got something wrong there. I said I can edit shader files, once they are completed - you know, tweaking a number here and there, but that's it. I won't implement anything and I also won't compile the game myself. I'm not a programmer.
Btw, why does your guardian.material look so different compared to tzlaine's ship.material?
If your example is supposed to show the normal bump texture, than something clearly doesn't work, have a look at the bottom right image in the first mockup and notice the details the normal map brings out.
edit: My guess is, we'll need something along the lines of this.
edit2: I actually did some reading on shader(GLSL) programming and found out, that a 2 point lighting setup, can be realized with just one lightsource by inverting the normal. If you need more information on this, message me.
Btw, why does your guardian.material look so different compared to tzlaine's ship.material?
If your example is supposed to show the normal bump texture, than something clearly doesn't work, have a look at the bottom right image in the first mockup and notice the details the normal map brings out.
edit: My guess is, we'll need something along the lines of this.
edit2: I actually did some reading on shader(GLSL) programming and found out, that a 2 point lighting setup, can be realized with just one lightsource by inverting the normal. If you need more information on this, message me.
Re: Version 0.320 - ship rendering, lighting and shaders
I don't Know how to setup à 2 Way Lightning setup.
Question: what do you do when there are more than One ships there?
There wouldn't Be à Solution.
However i'll supply in à Few hours à New pic how far i am.
It is all Inside it. I am so far that for à System the Combat will Be started and the Player has the possibility to Place His ships. Altough they cant Be Set right now.
Question: what Solution do you prefer when the Combat Starts- predefined Start points or costomizable by placing your ships?
By the Way: i have Advanced Code with the hotkeymanager and this now. How do i commit my Code to the database?
It seems that geoff doesnt have the Time to add it to the project, and what about putting me on the creators List ?
Question: what do you do when there are more than One ships there?
There wouldn't Be à Solution.
However i'll supply in à Few hours à New pic how far i am.
It is all Inside it. I am so far that for à System the Combat will Be started and the Player has the possibility to Place His ships. Altough they cant Be Set right now.
Question: what Solution do you prefer when the Combat Starts- predefined Start points or costomizable by placing your ships?
By the Way: i have Advanced Code with the hotkeymanager and this now. How do i commit my Code to the database?
It seems that geoff doesnt have the Time to add it to the project, and what about putting me on the creators List ?
Re: Version 0.320 - ship rendering, lighting and shaders
I think I've covered this. Either each ship get's it's own lightsource, that works only on that particular ship. Or, and that's probably the better solution in terms of resource efficiency, a shader "trick" has to be found. Also note my more recent edit2 about inverting surface normals. I thought you were the guy interested in graphics programming?strooka wrote:I don't Know how to setup à 2 Way Lightning setup.
Question: what do you do when there are more than One ships there?
There wouldn't Be à Solution.
Anyway, here is some more info on this:
To mimic OpenGL's two-sided lighting behavior, you need to invert the surface normal and perform the same computations as defined in the preceding section using the back-facing material properties. You can probably do it more cleverly than this, but it might look like this:There is no need to perform clamping on the values assigned to gl_BackSecondaryColor and gl_BackColor because these will be clamped automatically by definition.Code: Select all
normal = -normal; // Clear the light intensity accumulators amb = vec4 (0.0); diff = vec4 (0.0); spec = vec4 (0.0); // Loop through enabled lights, compute contribution from each for (i = 0; i < NumEnabledLights; i++) { if (gl_LightSource[i].position.w == 0.0) DirectionalLight(i, normal, amb, diff, spec); else if (gl_LightSource[i].spotCutoff == 180.0) PointLight(i, eye, ecPosition3, normal, amb, diff, spec); else SpotLight(i, eye, ecPosition3, normal, amb, diff, spec); } color = gl_BackLightModelProduct.sceneColor + amb * gl_BackMaterial.ambient + diff * gl_BackMaterial.diffuse; if (SeparateSpecular) gl_BackSecondaryColor = vec4 (spec * gl_BackMaterial.specular, 1.0); else color += spec * gl_BackMaterial.specular; gl_BackColor = color;
There has to be a way to place ships before combat eventually, but for now, just load a couple of ships somewhere. It doesn't really matter at this point.Question: what Solution do you prefer when the Combat Starts- predefined Start points or costomizable by placing your ships?
I don't decide these things. If the code meets Geoff's standards and does what it is supposed to do, I'm sure he will commit it or provide SVN access.By the Way: i have Advanced Code with the hotkeymanager and this now. How do i commit my Code to the database?
It seems that geoff doesnt have the Time to add it to the project, and what about putting me on the creators List ?
p.s. Check your pm's.
Re: Version 0.320 - ship rendering, lighting and shaders
ok, here is, what i've found out and readied up yet:
it shows placing of a ship in 3d combat mode while playing the game.
it shows placing of a ship in 3d combat mode while playing the game.
Re: Version 0.320 - ship rendering, lighting and shaders
Fascinating Can I get a closeup and also see the unlit side?
Re: Version 0.320 - ship rendering, lighting and shaders
I don't like it. You should have asked for a mockup... Instead of using a scaled up version of the ship mesh it's probably better to use either an ellipsoid or a seperate simplified shield mesh, fitted around the ship. The shield shader could be build similar to an atmosphere shader, being more visible as the surface normal turns away(fresnel effect).
Anyway, I noticed the specular map isn't part of the ship's shader. Are you going to add it? Also how is the 2 point lighting comming along? How about the FPS test? Let's first get the basics down, before we play with effects.
Anyway, I noticed the specular map isn't part of the ship's shader. Are you going to add it? Also how is the 2 point lighting comming along? How about the FPS test? Let's first get the basics down, before we play with effects.
Re: Version 0.320 - ship rendering, lighting and shaders
i have written a cg program that computes a simplified shape around the ship. but then i have problems with transparency. i'll go back to this problem later.
since there are already 1000 asteroids in object space and it is running still fast, i think there won't be a problem to add 250 more objects.
the map is part of the material, as you see.
i don't think that we should use all highlights with that effect.
since there are already 1000 asteroids in object space and it is running still fast, i think there won't be a problem to add 250 more objects.
Code: Select all
modified_material = ship_material->clone(modified_material_name);
modified_material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->
setTextureName(ship.Design()->Model() + "_Color.png");
modified_material->getTechnique(0)->getPass(0)->getTextureUnitState(1)->
setTextureName(ship.Design()->Model() + "_Glow.png");
modified_material->getTechnique(0)->getPass(0)->getTextureUnitState(2)->
setTextureName(ship.Design()->Model() + "_Normal.png");
modified_material->getTechnique(0)->getPass(0)->getTextureUnitState(3)->
[b]setTextureName(ship.Design()->Model() + "_Specular.png");[/b]
i don't think that we should use all highlights with that effect.
Re: Version 0.320 - ship rendering, lighting and shaders
The asteroids are rendered using Paged Geometry, which is originally intended for huge amounts of trees. We can't use this for ships. Besides, the asteroid meshes have just a fraction of the polygon count of a ship.strooka wrote: since there are already 1000 asteroids in object space and it is running still fast, i think there won't be a problem to add 250 more objects.
Please do some FPS tests.
I don't see it in the screenshots and that's what counts to me. Check out my mockup/renderings. The specular map masks out the reflection of the lightsource, which gives it a nice metalic effect. To get something similar to the mockups, you would probably also increase the specular intensity(gloss?). It looks quite dull at the moment.the map is part of the material, as you see.
The code snipet you've posted doesn't actually do anything, besides asigning textures to techniques. Where is the part, that determines how the texture influences speculars?
What are you talking about?I don't think that we should use all highlights with that effect.
Please realize that this is a team effort. There should be a lot more communication, especially between both of us, since your current work involves a big visual part.
Re: Version 0.320 - ship rendering, lighting and shaders
i meant, when hilighting an object, for example when it is selected, i prefer a simple alpha factor yellow paint of the object.I don't think that we should use all highlights with that effect.
What are you talking about?
the code shows that the specular map is loaded. and i ve seen it like in your demo. i could change the refletion mask to make it more shiny.I don't see it in the screenshots and that's what counts to me. Check out my mockup/renderings. The specular map masks out the reflection of the lightsource, which gives it a nice metalic effect. To get something similar to the mockups, you would probably also increase the specular intensity(gloss?). It looks quite dull at the moment.
The code snipet you've posted doesn't actually do anything, besides asigning textures to techniques. Where is the part, that determines how the texture influences speculars?
fps tests are in the current stadium of the program not possible cause i have to make a savegame where are about 250 ships in combat, and solving the combat is dysfunctional, cause the end combat signal isn't properly computed.
if someone has a savegame with huge amounts of ships plz post it here.
Re: Version 0.320 - ship rendering, lighting and shaders
Well, there are numerous way's we could highlight selected objects. It's probably a good idea to explore in mockups. I've added this to 0.322. I'll write an introduction to both 0.322 and 0.321 when 0.320 is done.strooka wrote: i meant, when hilighting an object, for example when it is selected, i prefer a simple alpha factor yellow paint of the object.
That's one of the reasons I asked for closeups earlier. I need to evaluate your results and provide feedback, but I can't do this, if you don't provide images. But making it shinier is probably a good idea.i could change the refletion mask to make it more shiny.
Wouldn't it be much easier to do this, if the techdemo and client were still separate?fps tests are in the current stadium of the program not possible cause i have to make a savegame where are about 250 ships in combat, and solving the combat is dysfunctional, cause the end combat signal isn't properly computed.
if someone has a savegame with huge amounts of ships plz post it here.
Re: Version 0.320 - ship rendering, lighting and shaders
You can go into "starting_fleets.txt" and make it so each player starts with any desired number/design of ships.strooka wrote:if someone has a savegame with huge amounts of ships plz post it here.
Warning: Antarans in dimensional portal are closer than they appear.