hi everyone =)
after spedning quite some time in researching i havent found an satisfying solution on my problem: “how to get the vertex-color under the players feet”
in detail. i have a model file (using vertex colors and with assigned texture) and a player.
and i want the player to be just as bright as the gorund below him. since the shading on the gorund model is done via vertex colors i need the vertex-color at the point the player is currently standing. acutally it’s the surface’s color resulting from the 3 vertices building the face.
however. the texture itself has to be ignored in this case.
the method i’m looking for should be able to handle ~100 players without lagging the app to death.
any ideas? (except from manually doing-> using a collision ray,checking for the colliding triangle ,get all 3 vertices, calculate their distances to the collision point, getting their vertexcolors, calculate the resulting surface color)
oh and setting up 100 cameras which render 1x1pixel images of the models below the player without textures wasn’t concidered as very effitient,either
an easy and fast approach would be nice =)
ps: dont crack your brains…
What does your ground model look like? If it is something like a plane displaced with a heightmap, that would make things a bit easier.
it can look like almost anything. those things are hand-made and can contain flat terrain, building, even several floors above eachother… for flat terrain i simply could check a bitmap (the same one could use to shade the terrain without vertex-based- realtimelights)
… well that’s the problem of the whole thing
You could set up some collision objects that set the color of an avatar to a constant you assign to each collision object. So, when an avatar collides with such an object, i.e. enters a certain zone, its color is changed.
This would only work if you have a limited number of zones in your map where the color to be assigned to an avatar is the same. E.g. when you have some places in your map where you simulate shadow using vertex colors and you want to set the avatar’s color to black when it enters the shadow zone.
thx a lot laurens
i came to a very similar conclusion. actually the same except that i already have those zones. since my whole world is divided into blocks i can set up lists which can assign light attributes.
this wont work in 100% of the cases but it’s ok for most of the game and it’s no bad solution.
people wont complain because of a few light errors they might not even notice
i hope i can make this work with a only reasonable ammount of “handwork”.
in fact, if pixel lighting & shadows are so important you should check out shaders will be alot better looking and will even work with dynamic lights I think … and shaders are quite fast
Wannes:they are important. but they dont need to mach with 99.9%accuracy.its just like models should be britghtly in a snow-landscape, have a greenish/brownish tone in a forest, or simply darker when beeing in a cave. it simply should somewhat match the environment
hm. shaders tend to not work on non-shader hardware
aside from that i wouldn’t know how to use vertex or pixel shaders to determine the color below the players feet (well except the fact to use them simmilar to the way you would to it in software).
lighting the whole scene with dynamic lights and shaders is out of question. this would require high-end hardware since the scenes are huge.
i havent really decided on this yet but i think i’ll end up using lightmaps to store the light information. images are easy access and easy to edit.
or perhaps useing tags in the modelfile. well one of them
You could do one of the methods you suggested in the first post, or something similar, but as a preprocess and store the results as something easier to query in real-time. For instance, you could create a matrix that stores the sampled colors at regular intervals, you can integrate this into your pipeline by generating it with a script inside Blender.
I understand Quake did something similar to this to light the models in the environment. They did it in 3D, but I guess if your environment is open, 2D will do just fine as long as you sample the colors on the terrain and not some arbitrary plane.
well the problem is that i dont have flat terrian but a 3d-environment caves, buildings,cliffs… and the worst of all several walkable path above each other .
another idea i had would’ve been setting up a orthogonal camera rendering the floor below the player and while using the cam setting the textureoff() thing… perhaps 5 times per second and interpolate the results to avoid step shadow-jumps.
i really need to do some serious performance testing…
my tests so far:
-setting up 100 cameras rendering the floor (works great but is damn slow)