Hi!
As you might know, I'm the author of DX9 shaders for CFS3 (and more specifically WOFF). Sorry if my English slips sometimes, but I hope it is still understandable
In another thread I mentioned that I want to add support for reflector sights into the next version of my DirectX 9 shaders. This work won't be immediately useful for WOFF because WWI Aldis sight requires a different approach, and that's why I want to talk about it here and not on WOFF forums.
If you don't know what I'm taking about - here is a demo video I recorded months ago:
http://www.youtube.com/watch?v=p4-shLNwLyA
We had previously discussed the matter with gecko and he had a great idea of using sprite effects in *.xdp file to add a new reticle.
With this approach one can hex-edit m3d file to make existing reticle object fully transparent and then add a sprite in place of it. My shaders will detect this sprite by its texture name (for example any name starting with "Reticle") and apply some "magic" to move the sight as needed.
However, xdp sprite approach also has a few issues which I want to discuss.
1. The sprite is always square.
And the "glass" on which the reticle is projected is not (at least as it is seen from the pilot's point of view).
As gecko proposed this is solvable by making the sprite larger that the glass, but adding a "mask" texture which will define the area where the reticle can appear on the sprie. The mask may also allow to make the reticle gradually become fainter near the edge if needed.
One note though is that the mask has to be put into the same texture as the reticle, which is slightly tricky, but shouldn't be a big problem.
2. Aircrafts like Boulton Paul Defiant have a reflector sight in gunners cockpit which moves with the gun.
The sprite has fixed location and I think it is not directly solvable.
The solution for such models is to keep the existing reticle instead of using a sprite. However it is not as simple. In real reflector sights the glass is tilted so it will reflect the reticle towards the pilot. This is also true for Defiant and many other in game models. And it poses a challenge for my shaders because there is no way to tell where the guns are pointing based on gunsight model alone.
My current idea is to hex-edit the m3d file and change material properties for gunsight glass object in a way that encodes the tilt into them. For example, the gunsight object for Defiant has specular set to "00 00 00 40" and tilted at about 36 degrees. 36 is 24 in hex, so the specular has to be set to "24 00 00 40". This will have almost no effect on the look without my shaders, but if shaders are enabled they will read these bytes and will know where to put the reticle.
This is just an example, I haven't yet decided what the encoding scheme will be.
So... If anyone has any ideas or questions - let's discuss them.
Since I'm doing it for CFS3 modders I need your opinions on this feature
As you might know, I'm the author of DX9 shaders for CFS3 (and more specifically WOFF). Sorry if my English slips sometimes, but I hope it is still understandable
In another thread I mentioned that I want to add support for reflector sights into the next version of my DirectX 9 shaders. This work won't be immediately useful for WOFF because WWI Aldis sight requires a different approach, and that's why I want to talk about it here and not on WOFF forums.
If you don't know what I'm taking about - here is a demo video I recorded months ago:
http://www.youtube.com/watch?v=p4-shLNwLyA
We had previously discussed the matter with gecko and he had a great idea of using sprite effects in *.xdp file to add a new reticle.
With this approach one can hex-edit m3d file to make existing reticle object fully transparent and then add a sprite in place of it. My shaders will detect this sprite by its texture name (for example any name starting with "Reticle") and apply some "magic" to move the sight as needed.
However, xdp sprite approach also has a few issues which I want to discuss.
1. The sprite is always square.
And the "glass" on which the reticle is projected is not (at least as it is seen from the pilot's point of view).
As gecko proposed this is solvable by making the sprite larger that the glass, but adding a "mask" texture which will define the area where the reticle can appear on the sprie. The mask may also allow to make the reticle gradually become fainter near the edge if needed.
One note though is that the mask has to be put into the same texture as the reticle, which is slightly tricky, but shouldn't be a big problem.
2. Aircrafts like Boulton Paul Defiant have a reflector sight in gunners cockpit which moves with the gun.
The sprite has fixed location and I think it is not directly solvable.
The solution for such models is to keep the existing reticle instead of using a sprite. However it is not as simple. In real reflector sights the glass is tilted so it will reflect the reticle towards the pilot. This is also true for Defiant and many other in game models. And it poses a challenge for my shaders because there is no way to tell where the guns are pointing based on gunsight model alone.
My current idea is to hex-edit the m3d file and change material properties for gunsight glass object in a way that encodes the tilt into them. For example, the gunsight object for Defiant has specular set to "00 00 00 40" and tilted at about 36 degrees. 36 is 24 in hex, so the specular has to be set to "24 00 00 40". This will have almost no effect on the look without my shaders, but if shaders are enabled they will read these bytes and will know where to put the reticle.
This is just an example, I haven't yet decided what the encoding scheme will be.
So... If anyone has any ideas or questions - let's discuss them.
Since I'm doing it for CFS3 modders I need your opinions on this feature