Frictional Games Forum (read-only)
Can HPL2 do this? (Texture swapping based on camera) - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Can HPL2 do this? (Texture swapping based on camera) (/thread-17902.html)



Can HPL2 do this? (Texture swapping based on camera) - Arkham - 08-22-2012

Hey all --

I finished playing TDD and Justine as of a few days ago, and I enjoyed my "bout of Amnesia" a great deal. I'm excited at the idea of creating a short custom story, just to see what I can do in an engine centered around creating a horror experience.
While I've done modding/environment art in other contexts (mostly UT3/UDK) I'm asking this question as a complete newbie to HPL2, so I really have no idea if what I'm asking about is a reasonable expectation, or completely out of the question, so please bear with me.

This is an idea of mine that has been kicking around in my head in rudimentary fashion for a while now, but the painting of Alexander in the Transept section of the game really got me wondering if this game's engine could do something like this. I'm not much of a scripter, but if this kind of thing can be done then I might just have to learn how.

Consider the following setup:

Say we have a scene with a bunch of stained glass windows. Though it could be other things like paintings or whatever. For the purposes of fleshing out this example let's call it stained glass.
So, say you're walking down a cathedral nave or whatever, and there are several panes of stained glass on the walls around you.
Each window has two different versions of its particular texture -- one depicting a normal, innocuous-looking scene, and a second version with subtly warped/wicked/horrific details added.
Most of the windows will display their "normal" texture; but a few of them, randomly selected, will display the warped version by default.

Here's where I think it gets tricky --
The randomly-selected warped versions should only display the warped texture while they are located in the player's peripheral vision. Once the player looks at them (i.e. the camera views the window in question within a certain radius of the targeting reticle) they jump back to displaying the normal texture.

After this switcheroo-dealie, the warped version doesn't come back... for now. In other words, even if the player tries to move the suspiciously-behaving window back into their peripheral vision to see the warped version of the window, the window stubbornly continues to look normal. ("Was it all in my head??")

Once the window passes out of the camera's view entirely (the player is looking away or has walked passed it), a timer starts counting down for somewhere between 10 and 20 seconds. Once the timer finishes counting down, the whole script resets itself, and we go from the beginning -- either the window gets weird again in peripheral vision, or perhaps that window stays normal and another window gets selected for wierd-ification.

So, to actually distill all that into a question: is this possible/feasible? Huh
Thanks in advance.


RE: Can HPL2 do this? (Texture swapping based on camera) - Robby - 08-22-2012

(08-22-2012, 10:18 AM)Arkham Wrote: Hey all --

I finished playing TDD and Justine as of a few days ago, and I enjoyed my "bout of Amnesia" a great deal. I'm excited at the idea of creating a short custom story, just to see what I can do in an engine centered around creating a horror experience.
While I've done modding/environment art in other contexts (mostly UT3/UDK) I'm asking this question as a complete newbie to HPL2, so I really have no idea if what I'm asking about is a reasonable expectation, or completely out of the question, so please bear with me.

This is an idea of mine that has been kicking around in my head in rudimentary fashion for a while now, but the painting of Alexander in the Transept section of the game really got me wondering if this game's engine could do something like this. I'm not much of a scripter, but if this kind of thing can be done then I might just have to learn how.

Consider the following setup:

Say we have a scene with a bunch of stained glass windows. Though it could be other things like paintings or whatever. For the purposes of fleshing out this example let's call it stained glass.
So, say you're walking down a cathedral nave or whatever, and there are several panes of stained glass on the walls around you.
Each window has two different versions of its particular texture -- one depicting a normal, innocuous-looking scene, and a second version with subtly warped/wicked/horrific details added.
Most of the windows will display their "normal" texture; but a few of them, randomly selected, will display the warped version by default.

Here's where I think it gets tricky --
The randomly-selected warped versions should only display the warped texture while they are located in the player's peripheral vision. Once the player looks at them (i.e. the camera views the window in question within a certain radius of the targeting reticle) they jump back to displaying the normal texture.

After this switcheroo-dealie, the warped version doesn't come back... for now. In other words, even if the player tries to move the suspiciously-behaving window back into their peripheral vision to see the warped version of the window, the window stubbornly continues to look normal. ("Was it all in my head??")

Once the window passes out of the camera's view entirely (the player is looking away or has walked passed it), a timer starts counting down for somewhere between 10 and 20 seconds. Once the timer finishes counting down, the whole script resets itself, and we go from the beginning -- either the window gets weird again in peripheral vision, or perhaps that window stays normal and another window gets selected for wierd-ification.

So, to actually distill all that into a question: is this possible/feasible? Huh
Thanks in advance.
Seems interesting. I don't know about this one, and I know you can do some "sanity" visions, but they don't work the way you explained. I don't know if your idea may be possible, but maybe it is.

The "sanity" vision trick: Let's say we have that painting of Alexander. He is normal. Your sanity is about 56. There is the distorted version of the picture that appears when your sanity is 50 or below. Since your sanity is 56, the distorted pic isn't there. But once your sanity drops below 50, the picture will become distorted (if you look at the picture while your sanity drops, you won't see the effect until you look away for approx. 1 second. Same when the pic should return to normal). When your sanity goes above 50, the pic should return to normal (assuming you looked away for a second).

This does not reflect your idea, but this (^) is possible. And you don't even need to script it. Your idea needs some scripting, but it does not mean it is not possible. It is just complicated.


RE: Can HPL2 do this? (Texture swapping based on camera) - Your Computer - 08-22-2012

The engine has callbacks that can be set when a player is looking at an object. This, however, is limited to the white dot on the center of the screen. Peripheral vision, therefore, would have to be achieved using script areas that are larger than the object it is associated with or placed somewhere on the sides of the object. This means taking into consideration the user's window resolution.


RE: Can HPL2 do this? (Texture swapping based on camera) - Robby - 08-22-2012

(08-22-2012, 12:07 PM)Your Computer Wrote: This means taking into consideration the user's window resolution.
And that would be problematic.


RE: Can HPL2 do this? (Texture swapping based on camera) - Arkham - 08-22-2012

(08-22-2012, 12:07 PM)Your Computer Wrote: Peripheral vision, therefore, would have to be achieved using script areas that are larger than the object it is associated with or placed somewhere on the sides of the object. This means taking into consideration the user's window resolution.
Do you mean there would have to be differently-sized script areas for every possible monitor resolution (daunting, and maybe impossible if Amnesia supports custom resolutions)?
Or do you mean there would have to be different ones based on possible monitor ratios, i.e. 5:4, 16:9, 16:10 (which seems a lot more doable)?


RE: Can HPL2 do this? (Texture swapping based on camera) - Robby - 08-22-2012

(08-22-2012, 06:56 PM)Arkham Wrote:
(08-22-2012, 12:07 PM)Your Computer Wrote: Peripheral vision, therefore, would have to be achieved using script areas that are larger than the object it is associated with or placed somewhere on the sides of the object. This means taking into consideration the user's window resolution.
Do you mean there would have to be differently-sized script areas for every possible monitor resolution (daunting, and maybe impossible if Amnesia supports custom resolutions)?
Or do you mean there would have to be different ones based on possible monitor ratios, i.e. 5:4, 16:9, 16:10 (which seems a lot more doable)?
To me it seems kinda like it. But I may be wrong here, though.


RE: Can HPL2 do this? (Texture swapping based on camera) - Theforgot3n1 - 08-22-2012

This actually sounds rather easy, if I'm not unaware about some core problem revolving this.
Why would it not be possible?


RE: Can HPL2 do this? (Texture swapping based on camera) - Your Computer - 08-22-2012

(08-22-2012, 06:56 PM)Arkham Wrote: Do you mean there would have to be differently-sized script areas for every possible monitor resolution (daunting, and maybe impossible if Amnesia supports custom resolutions)?
Or do you mean there would have to be different ones based on possible monitor ratios, i.e. 5:4, 16:9, 16:10 (which seems a lot more doable)?

I wouldn't say it is as daunting as it sounds. You should be able to find a sweet spot for most resolutions. Just take into consideration one resolution, like 1024x[height], and work around that, forgetting about smaller sizes. Full conversions can suggest what resolution the game should start at, but the player can change that resolution at any given time. There's no way to detect what resolution the player is using through scripts, but if you keep to one standard, that shouldn't be an issue. If some players miss out because they choose to play on dated hardware, i would argue that's their problem.


RE: Can HPL2 do this? (Texture swapping based on camera) - Apjjm - 08-23-2012

I have a few, um, hacks which may be able to help with detecting orientation of the player (which you can then use to work out what is in the peripheral vision). I'm going to have a play about tomorrow to see how feasible they are before I get your hopes up with anything though.


RE: Can HPL2 do this? (Texture swapping based on camera) - Arkham - 08-23-2012

Thanks for the ideas/feedback, everyone. Sounds encouraging. I'll have to start learning the level editor and getting Maya set up to export opencollada files...