Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / shadow mapping demo for two lights

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2012 13:57 Edited at: 14th Apr 2012 14:02
Here's a simple demo of shadow mapping using two positional lights. You might need Dark Shader to run this.

Move the main camera back and forth with the up/down keys, and turn it with the mouse. Press <spacebar> or <esc> to exit.

Sample screenshot:



One thing puzzles me about the demo. If I uncap the sync rate and press 1 for a sample shadow map then the sync rate and object movement increases. Can someone explain this simply for me? I would expect the extra render to slow things down. Any ideas anyone?

This is a very basic shader with no bump mapping etc but shows the basic method. I'm hoping to prepare a better version when the DBPro cube mapping bugs are sorted out.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2012 13:59
Screen shot for previous post.

Attachments

Login to view attachments
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 14th Apr 2012 14:11
Argggh. I'm working on a different PC without DBP installed today. Can we have a compiled version too please?!

Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 14th Apr 2012 21:51
Quote: " If I uncap the sync rate and press 1 for a sample shadow map then the sync rate and object movement increases. Can someone explain this simply for me? I would expect the extra render to slow things down. Any ideas anyone?"

if I uncap it, it runs a little faster. If I press 1 then it runs a little slower as it should. I don't know why are you experiencing the opposite effect

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2012 00:54 Edited at: 15th Apr 2012 00:59
Neither do I (but see below).

When I have the sync rate capped at 60 it runs at 58/59 fps but drops to 29 when I press 1 as I might expect.

Strangely, I've done the uncapped again and the fps ranges from 102-145 without 1 pressed and 92-130 with. Then a few minutes later both sets of fps ranges dropped for no obvious reason. The fps seems to depend on whether the "tiny" model is on screen or not so perhaps I wasn't paying careful attention when I tried it before. Why both sets should suddenly fall I don't know - but my guess is something like Norton is doing something (and my GFX card plays up from time to time).

It seems there's probably nothing odd going on at all.

Quote: "Can we have a compiled version too please?!"


Capped version attached.

Attachments

Login to view attachments
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2012 02:46
Quote: "Capped version attached."


Thanks for that. I've wanted to do multi point light shadows for years. Once light source is really limiting, so it's good to see people doing that with shadow map shaders.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2012 12:03
My original idea was to render each light's shadow map to a different colour component of the same cube map image. Unfortunately I can't get that idea to work in DBPro using cube maps - and the only method that works at all uses the Dark Shader commands which have a different limitation. At the moment I'm not sure whether it's bugs or limitations that are holding me up.

My preferred solution would work as follows:

1. Use the set cube mapping on command since that allows you to update each of the six images separately - e.g. just update one each sync to keep the frame rate up. (That part works - but not in combination with everything else that's needed.)

2. Render each of the six light cameras twice (for two lights - the extension to more lights should be obvious) one to the red channel and once to the green channel using additive texture blending. (That part also works for conventional camera output images - I just can't get it to work with the cube mapping command applied to several objects.)

3. In the shader use one shadow map for up to four lights. This allows you to keep the other 7 available textures for things like terrain blending, bump mapping etc. (That part works as far as I can tell - but without a correctly constructed dynamic cube map it's hard to be certain.)

The advantage of using a cube map rather than a single image is that a light can cast shadows in all directions and simplifies the problem of integration with the main camera movement.

The present solution uses Dark Shader commands which require a separate cube map for each light. If I recall correctly the only reason I can't render twice is that each render dynamic cube map command clears the 3D backdrop so I can't use additive blending from two (or more) renders. Very annoying.

DBPro/Dark Shader have everything I need but not all at once. I'm hoping that IanM's work on the "most annoying bugs" will sort out the set cube mapping on command but I'm not sure the present problem is covered by his remit. We can all live in hope though.

Once I've got all that sorted out it'll be worth adding filtering to the shadow mapping shader to soften the shadow edges.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2012 13:29
This is an area I've not played with at all yet. I understand the concept of rendering a camera from the light's perspective to achieve a depth map, but how you attach this to the scene with your cube mapping still doesn't make complete sense to me.

I have a few questions anyway!

Quote: "1. Use the set cube mapping on command since that allows you to update each of the six images separately - e.g. just update one each sync to keep the frame rate up. (That part works - but not in combination with everything else that's needed.)"


Sounds like a sensible optimisation!

Quote: "2. Render each of the six light cameras twice (for two lights - the extension to more lights should be obvious) one to the red channel and once to the green channel using additive texture blending. (That part also works for conventional camera output images - I just can't get it to work with the cube mapping command applied to several objects.)"


I take it there are 6 camera renders per light, one for each face of the cube map? Out of interest, do you think it's be possible to expand the FOV to 180, or maybe even the complete 360 if that's possible, perform fewer renders and extract 6 images from these larger perspectives?

Without seeing the code, I don't know fully get how you're rendering to specific channels, though the theory makes sense to me. I like that approach because I think 3 of 4 dynamic lights mapped to separate colour components is plenty. More than 4 is a overkill I think.

Also, how do the final shadow map renders become shadows from the camera's perspective? This is the bit I don't get. Does the shader calculate how the shadow map is applied to the final camera render, or does cube mapping handle it?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2012 14:39
Quote: "but how you attach this to the scene with your cube mapping still doesn't make complete sense to me"


The cube mapping commands just apply the cube map to texture stage 1 for use in the shader.

Quote: "I take it there are 6 camera renders per light, one for each face of the cube map?"


Yes.

Quote: "Out of interest, do you think it's be possible to expand the FOV to 180, or maybe even the complete 360 if that's possible, perform fewer renders and extract 6 images from these larger perspectives?"


Interesting question. The advantage of using six images with 90 FOV is that it all pieces of the entire scene fit together neatly - and shader cube map lookups do all the awkward projection maths for you. Even if you could fiddle with the FOV and get, say, four renders rather than six, I suspect the final image extraction/lookup stage would be too expensive. If you could render to triangles you could render the whole scene to a tetrahedron. Some kind of masking procedure might be needed. My gut feeling though is that it would be a lot of work to get the idea working. It should be simpler to get the bugs out of DBPro ...

Quote: "Without seeing the code, I don't know fully get how you're rendering to specific channels"


Have a look at the attached simplified demo which shows you how easy it is in DBPro. If you can't compile it just look at the fx and dba code, it's very basic (). The zip file contains a sample camera image where you can see the result of the red and green renders added together.

Quote: "I like that approach because I think 3 of 4 dynamic lights mapped to separate colour components is plenty. More than 4 is a overkill I think."


Agreed. But if we could get the DBPro bugs/limitations removed then masochists could experiment with 16 lights and four cube maps or worse. After all, if you're in a street with lots of street lights you'd want dynamic shadows from all of them, regardless of the processing cost, wouldn't you?

Quote: "Also, how do the final shadow map renders become shadows from the camera's perspective? This is the bit I don't get. Does the shader calculate how the shadow map is applied to the final camera render, or does cube mapping handle it?"


Somewhat surprisingly, that's actually the easy bit. Cube map lookups in shaders are trivial. Suppose you need to decide whether a particular point in your main scene is in shadow. The shader knows the world space position of your point. It also knows the position of the lights (assuming you remembered to tell it of course ). You then just calculate the direction of your world point from the light's position, i.e. simply the difference between the two sets of XYZ coordinates. You then use that vector in your cube map lookup for the light. There's no need to normalize the direction vector - the hardware/DX9 does that automatically for you when looking up a cube map. The texture lookup tells you the distance of the nearest rendered point in that particular direction. If your object's point is further away than that rendered point then it must be in shadow for that light. You then just repeat that process for each light using a different colour component or cube map as appropriate. Yes, all the real work is done in the shader, the cube mapping simply applies the cube map to a texture stage.

I wonder if it's too late to ask IanM to look into this???

Attachments

Login to view attachments
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2012 15:50
Sorry, I'm being a pleb. I forgot you'd added code in the first post. I only looked at the EXE version.

Interesting stuff. It looks fairly straight forward, though the final wizardry of converting a cube map of depth data in a texture stage on an object, to correctly shaded pixels in the final render, still hadn't quite sunk in. I get it overall though.

So am I right in saying you simply what to render these two cube maps, combine them into one cube map, use 1 texture layer in your objects, and then get the shader to extract two set of light depth data from the one map?

If you can't module them with DBP commands, I wonder if you could write a super fast DLL to do it by using a pointer to each rendered cube map?

Another thought is, can you create cubemaps from bitmaps? If so, could you extract images from your rendered cube maps, paste them to a bitmap, and then generated a new cube map from that bitmap? If so, you could even squish separate cubemap images together. i.e. For the top image of the cube map, squeeze the light 1 render into the left side of that image and light 2 render in the right side, then update the shader to read from the appropriate side of the cube map image depending on which light it was considering.

I'm sure there are other possibilities which are equally weird and drastic. What's the end goal though? To just free up a texture stage, or save video mem, or do you think it'd increase performance with one texture?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2012 17:51
Quote: "So am I right in saying you simply what to render these two cube maps, combine them into one cube map, use 1 texture layer in your objects, and then get the shader to extract two set of light depth data from the one map?"


As a minimum. I'd also like to have control over when I render each of the six component views for performance reasons.

Quote: "If you can't module them with DBP commands, I wonder if you could write a super fast DLL to do it by using a pointer to each rendered cube map?"


I guess so but I'm not the man to ask.

Quote: "Another thought is, can you create cubemaps from bitmaps?"


Yes, but I don't know how to do it efficiently in real time.

Quote: "What's the end goal though? To just free up a texture stage, or save video mem, or do you think it'd increase performance with one texture?"


All three hopefully. If you want four lights then at the moment you need four cube maps so you only have four texture stages available for everything else. One of my terrain blending shaders uses all 8 stages so something would have to give. The Dark Shader route which I'm forced to use at the moment doesn't seem to have the option to change the texture format so the unused channels (I use the red channel) would be wasted space. DBPro allows you to change the camera image target format to something like D3DFMT_L8.

It's possible that combining the maps into one single cubemap might be counterproductive. If the GFX card has to switch rapidly between reading different parts of the same image (which is what would happen) then that might disrupt some of the efficient parallelism in the hardware texture reads. But such details are quite beyond me but is the sort of thing discussed at length in various nVidia articles. I generally just ignore such discussion and do the naive straightforward thing when I code shaders. I'm sure they can be improved with a bit more technical know-how.

At the moment I can only speculate on the possible performance effects.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2012 19:51 Edited at: 15th Apr 2012 19:52
I suppose these are all just the limitations of a beginner language. It only feels like shaders have been adopted by the community in a big way in the last few years, or maybe that's just how I see it. As usual, there aren't many people pushing the envelope though, so shortfalls tend to linger. Hopefully some of the changes you may end up suggesting will be implemented.

Btw, I can see your thinking behind rendering one face per game loop to improve performance. The jerkiness added to shadow updates would probably be fine, because it'd be minimal and the eye is drawn to the moving characters more than the shadows anyway. I don't see a problem with you just rendering all the whole cube map every 6 frames though. Jerkiness would be the same, and doing something every 6 frames is still quick enough to negate visually obvious pauses.

Just a thought. As you well know, you always have to find work arounds with DBP when you start pushing it, so maybe reducing the rendering frequency of your lightmaps is the best option for performance.

Edit: Btw, is this for a specific project or just a tech investigation?

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 15th Apr 2012 20:37
This is cool

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2012 20:53
Quote: "I don't see a problem with you just rendering all the whole cube map every 6 frames though."


The problem with that is that everything is affected once every six frames so you'd need to use timer based movement, etc. Perhaps we should be using that anyway though.

Quote: "Btw, is this for a specific project or just a tech investigation?"


At the moment it's just a tech investigation although I looked into it originally because Hawkblood was hoping to use it in his project. I'd happily use it in a project though.

Quote: "This is cool"


Thanks.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2012 21:14
Quote: "The problem with that is that everything is affected once every six frames so you'd need to use timer based movement, etc. Perhaps we should be using that anyway though."


I take it you're referring to character animation? I'm a strong champion of the enhanced animation plugin. The built in commands are only good for basic animation, and cause the sort of problems you're seeing in this for example (when you hit 1 and everything slows down, the character is still walking at the same speed). With enhanced animations, you can advance the frames with a lot more control and it is completely decoupled from syncing. Much better!

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2012 00:14
Quote: "I take it you're referring to character animation?"


And camera movement, etc. Thanks for the tip about enhanced animation.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Apr 2012 00:35 Edited at: 16th Apr 2012 00:37
The reason you are getting the odd frame rates is due to VSync. With VSync enabled, the frame rate must be a factor of 60 (assuming each frame takes the same amount of time to render) so if it can't quite do 60 and can only manage about 55 uncapped, it will drop to 30 with vsync on. If it keeps slowing down it would drop to 20, 15, 12, 10, etc. It seems that when you are uncapping the frame rate you are also disabling VSync, so the frame rate can be anything.

[b]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2012 00:43
Which question are you answering?
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Apr 2012 02:04 Edited at: 16th Apr 2012 02:04
Quote: "One thing puzzles me about the demo. If I uncap the sync rate and press 1 for a sample shadow map then the sync rate and object movement increases. Can someone explain this simply for me? I would expect the extra render to slow things down. Any ideas anyone?"


I was just saying VSync can make it run slower than it would otherwise and it could be the reason for the above.

[b]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2012 02:19
Further down I said I couldn't reproduce that - and I don't think I'm using Vsync (unless it's the default ). But capped I get 58 or 59 quite often so does that mean I haven't got Vsync set?
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Apr 2012 15:42
Btw Mr Gandalf, is this a shader you've written yourself or is it one available elsewhere? In a week or so, I'd like to look into adding realtime shadows to Carnage, once the level editor is mostly complete.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2012 19:18
I wrote it myself.

Quote: "In a week or so, I'd like to look into adding realtime shadows to Carnage, once the level editor is mostly complete."


Just shout if you need help with that.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Apr 2012 19:59
Thanks dude.

Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 16th Apr 2012 21:18 Edited at: 16th Apr 2012 21:20
wait wait wait, are you lot saying that it's not normally feasible, or easy to have more than 1 light source in a DBPro game? I know the inbuilt lighting commands are absolute balls and that most people use shaders for lighting. So then how do so many games dating back to the late 90's have multiple light sources and shadows?

One of the projects I was working on absolutely NEEDED a minimum of 4 smooth dynamic lights, and an ambient HDR light source. I also wanted good shadow casting to create 'spookiness' as creatures run in front of forward facing light sources. Without it this would ruin about 80% of the atmosphere. I hadn't quite got the stage of working on shaders, would this have presented a problem?
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Apr 2012 21:35 Edited at: 16th Apr 2012 21:36
Lighting isn't a problem. You can have many light sources. It's the shadow mapping that is limited. The shadow shading commands in DBP only use 1 light source, so you need to write your own shadow mapping shader like Mr Green here, if you want to have multiple light sources cast dynamic shadows. Additionally the shadow shading command in DBP is a bit dodgy, casting shadows through multiple layers of geometry.

Shaders are the way forward here.

revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 17th Apr 2012 00:56
Quote: "I hadn't quite got the stage of working on shaders, would this have presented a problem? "
This could still cause a problem. You need to be very careful with polycounts and syncing when using any muli-light/shadow setups or you can easily kill your chance of achieving "smooth dynamic lights".

Quote: "Additionally the shadow shading command in DBP is a bit dodgy, casting shadows through multiple layers of geometry."
But note that this is a limitation of stencil shadowing rather than DBPro itself, those types of problems are visible in many professional games. Thats not to say DBPro's built-in shadows aren't lacking, and it is nearly impossible to get a low-poly animated model to look right without any Z-clashing/over shadowing (another problem with stencil shadows). My main complaint is the fact that shadows are cast to distances on a per-object basis, rather than by the light's range.
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 17th Apr 2012 09:34 Edited at: 17th Apr 2012 09:35
Once I've read somwhere here that set cubemapping on using 6 images is not 100% compatible with shader stuff unlike single image. Am I wrong?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Apr 2012 12:07
You are right and it was included in the annoying bugs list. But there may be other problems with it that weren't included in the list.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Apr 2012 15:44
I was thinking about this shadow mapping techniques today. If we had a facility in DBP/GDK to mask which objects were rendered to which camera, you could potentially do the following:

- For static lights, render a cube map which is calculated for all static geometry
- Every loop, render a cube map which only renders moving objects
- Merge both cube maps with a "if lighter" style filter, as the moving geometry would only factor into the cube map if it's depth (and therefore brightness) is brighter than that on the static cube map.

A more in depth process could be:
- Render the static cube map lighting once
- Each loop, for each of the 6 rendering faces, check if dynamic objects are a) visible on it, and b) have moved
- You then simply render only the faces which contain objects that have moved, and only the dynamic objects
- Modulate the single single face cube map image with the static one (simply if the RGB colour component for each pixel is brighter, replace it with the brighter one)

I know this is a bit beyond the scope of DBP at the moment, but I would imagine it'd make for really fast dynamic lighting for static lights.

Just thinking!

mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 17th Apr 2012 16:10
@Green Gandalf
Could you please remind me what are these problems?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Apr 2012 17:14
Quote: "If we had a facility in DBP/GDK to mask which objects were rendered to which camera"


set object mask perhaps?

Your solution sounds very similar to what I was proposing. The main problem at the moment is that I can't get the DBPro cube mapping command to work on several objects at once. The Dark Shader version works nicely but doesn't give you access to the individual component images. So we need either a bug fix or a new feature and possibly both.

Quote: "Could you please remind me what are these problems?"


See my fourth post on this thread.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Apr 2012 17:40
Quote: "set object mask perhaps?"


Ahhh yes. I remember seeing that command. The problem is, it doesn't exist in GDK, which is what I'm using for Carnage. It's obviously a relatively new addition (i.e. within the last 2 years ) which is why GDK doesn't have it.

Shame about the problems you're having with cube maps. When I get to that stage, and if I happen upon the same issues, maybe we can try and figure out a solution.

Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 17th Apr 2012 18:17
Quote: "The problem is, it doesn't exist in GDK, which is what I'm using for Carnage"

why don't you compile GDK libraries yourself

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 17th Apr 2012 19:32
Quote: "The problem is, it doesn't exist in GDK, which is what I'm using for Carnage"

The DGDK code for 'set object mask' was published and it can be incorporated into your project (no need to recompile DGDK libraries).

I don't have the code at hand right now, but post a question (or dig) in the DGDK forum and I will post it there.

Nevertheless, I think 'set object mask' is not needed in some cases, as it is covered using dbSyncCamera, but I think that needs Dark Shader libraries. Oh well.

Back on topic

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Apr 2012 20:18
Object mask for GDK:


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Apr 2012 21:02 Edited at: 17th Apr 2012 21:09
Yes, it ought to be there - it's been in DBPro since at least U6.3 (October 2006). Not sure when it first made it's entrance - the Help file entry seems to have appeared later (true you'll be surprised to hear ).

Edit Seems to be some time after U5.7 - I can't see it mentioned in any of the upgrade notes although I recall it was introduced with a fanfare from Lee. I could be imagining things though.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Apr 2012 22:11 Edited at: 17th Apr 2012 22:13
Doesn't surprise me! Truth be told I've never made a game with more than one camera. Never had the need for it, so never had the need for an object camera mask, but I can see the benefit of it, especially for split screen games or editors.

Edit: @Matty, I didn't know there was a dbGetObject command either. Going to look at that tomorrow and see what nuggets it yields.

mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 18th Apr 2012 09:07
@Green Gandalf
Yes, I've read that before... the problem is
Quote: "I just can't get it to work with the cube mapping command applied to several objects"

?
You mean you can't render same cameras for several times per cycle?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Apr 2012 14:13
Possibly - but I said:

Quote: "I just can't get it to work with the cube mapping command applied to several objects"


In fact I can't get simple cube mapping to work correctly with just two objects cube mapped - see attached demo. That's without the extra complications of shadows and two cube maps, etc.

I may be overlooking something very simple. What do you think?

In the demo both spheres should be cube mapped - but I can't get them both cube mapped at the same time.

Attachments

Login to view attachments
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 18th Apr 2012 15:16
I've tested your demo. IMHO it's not a bug, it's not-a-feauture, as cubemapping works OK with regular images. The trick with the camera image, it's something special, in our case several images combined into cubemap, so there is might be memory accsess to cameras' buffers issue. AFAIR you can't lock those images or smth. I always wanted to have "copy camera image" feauture, but only can paste it to bitmap with dreadful fps.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Apr 2012 16:32
I don't understand your argument. Dark Shader commands have no problem applying the same cube map to several objects so why can't DBPro?
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 19th Apr 2012 09:59 Edited at: 19th Apr 2012 09:59
Then why I can't do this:
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Apr 2012 14:17
You've lost me now.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Apr 2012 15:04
@mrHandy
It's true that images which are render targets cannot be locked, so cannot be converted into a memblock, but that's no reason for them not to be usable for cube mapping.

[b]
James H
16
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Apr 2012 15:55
I would agree that it should work on multiple objects, works fine with a clone of the object after its been applied which is limited in use, additionally if you place a sync between the two cube map commands you can see the very first image on the other object remaining frozen, its appearance apparently correct otherwise

Login to post a reply

Server time is: 2024-04-18 23:36:17
Your offset time is: 2024-04-18 23:36:17