RenderPostOffset
Moderator: NBJeff
RenderPostOffset
I noticed they added a property RenderPostOffset and RenderPreOffset in materials.txt in the last few patches. Does anyone know exactly what this is supposed to do?
- aubergine18
- level2
- Posts: 231
- Joined: Sun Jul 05, 2015 3:24 pm
Re: RenderPostOffset
Not sure but seems to be something to do with animation on things like weight bench, etc. If you find out more please let me know and I'll update the guide:
http://steamcommunity.com/sharedfiles/f ... =496272007
http://steamcommunity.com/sharedfiles/f ... =496272007
Re: RenderPostOffset
RenderPostOffset and RenderPreOffset are used in objects that consist of two sprites, a base sprite and an overlay.
RenderPre/PostOffset offsets the RenderDepth of the overlay, i.e. RenderDepth(overlay) = RenderDepth(base) + RenderPre/PostOffset
The WeightsBench for example has RD 1 and RPO 2. A Prisoner (RD 2) is rendered on top of the WeightsBench and on top of that is rendered the WeightsBar (RD 1+2)
The other objects are ServingTable(0)/FoodTray(1)/ServingTableLid(2), DogCrate(0)/Dog(2)/DogCrateTop(3), RoadGatePosts(0)/RoadGate(2)
I have no idea though where they defined which sprite to use as an overlay. Could this be hard coded?
RenderPre/PostOffset offsets the RenderDepth of the overlay, i.e. RenderDepth(overlay) = RenderDepth(base) + RenderPre/PostOffset
The WeightsBench for example has RD 1 and RPO 2. A Prisoner (RD 2) is rendered on top of the WeightsBench and on top of that is rendered the WeightsBar (RD 1+2)
The other objects are ServingTable(0)/FoodTray(1)/ServingTableLid(2), DogCrate(0)/Dog(2)/DogCrateTop(3), RoadGatePosts(0)/RoadGate(2)
I have no idea though where they defined which sprite to use as an overlay. Could this be hard coded?
- aubergine18
- level2
- Posts: 231
- Joined: Sun Jul 05, 2015 3:24 pm
Re: RenderPostOffset
From objects.spritebank:
RenderPreOffset
BEGIN "[i 488]" Name RoadGate x 39 y 4 w 14 h 2 RotateType 0 TopAligned false END
BEGIN "[i 489]" Name RoadGatePosts x 39 y 0 w 14 h 4 RotateType 4 TopAligned false END
RenderPostOffset
BEGIN "[i 87]" Name DogCrate x 36 y 52 w 2 h 4 RotateType 1 TopAligned false END
BEGIN "[i 89]" Name DogCrateTop x 36 y 56 w 2 h 4 RotateType 1 TopAligned false END
BEGIN "[i 503]" Name ServingTable x 0 y 37 w 10 h 3 RotateType 1 TopAligned false END
BEGIN "[i 504]" Name ServingTableLid x 16 y 40 w 8 h 2 RotateType 1 TopAligned false END
I thought the Pre offset might have looked for second sprite directly above the sprite named in materials.txt, and Post offset might have looked directly below... But then saw ServingTable and that blew that idea out of the water.
So looks like you are correct in both statements: Pre/Post offset affects render depth of second sprite, and second sprite is almost certainly hard-coded (which is a shame because that pre/post offset feature would probably be useful to modders). Well, at least now we know what the settings do, kudos for working it out!
EDIT: If using sprites.png for your sprites, you can define multiple BEGIN Sprite ... END blocks.... So maybe we can specify the second sprite when doing things that way? If you get chance, please test and report back.
RenderPreOffset
BEGIN "[i 488]" Name RoadGate x 39 y 4 w 14 h 2 RotateType 0 TopAligned false END
BEGIN "[i 489]" Name RoadGatePosts x 39 y 0 w 14 h 4 RotateType 4 TopAligned false END
RenderPostOffset
BEGIN "[i 87]" Name DogCrate x 36 y 52 w 2 h 4 RotateType 1 TopAligned false END
BEGIN "[i 89]" Name DogCrateTop x 36 y 56 w 2 h 4 RotateType 1 TopAligned false END
BEGIN "[i 503]" Name ServingTable x 0 y 37 w 10 h 3 RotateType 1 TopAligned false END
BEGIN "[i 504]" Name ServingTableLid x 16 y 40 w 8 h 2 RotateType 1 TopAligned false END
I thought the Pre offset might have looked for second sprite directly above the sprite named in materials.txt, and Post offset might have looked directly below... But then saw ServingTable and that blew that idea out of the water.
So looks like you are correct in both statements: Pre/Post offset affects render depth of second sprite, and second sprite is almost certainly hard-coded (which is a shame because that pre/post offset feature would probably be useful to modders). Well, at least now we know what the settings do, kudos for working it out!
EDIT: If using sprites.png for your sprites, you can define multiple BEGIN Sprite ... END blocks.... So maybe we can specify the second sprite when doing things that way? If you get chance, please test and report back.
- aubergine18
- level2
- Posts: 231
- Joined: Sun Jul 05, 2015 3:24 pm
Re: RenderPostOffset
Hrm, look at the sprite numbering... Pre offset takes "[i sprite-1]", Post offset takes "[i sprite+1]"... that's how they do it I believe...
Re: RenderPostOffset
Defining a second sprite and adding the RenderPostOffset property doesn't do anything. I tested it with 2 sprites of the same dimention and rotate type.
Thats what i thought too at first but the DogCrate doesn't follow that scheme.
And changing the offset number doesn't change the sprite used.
Hrm, look at the sprite numbering... Pre offset takes "[i sprite-1]", Post offset takes "[i sprite+1]"... that's how they do it I believe...
Thats what i thought too at first but the DogCrate doesn't follow that scheme.
And changing the offset number doesn't change the sprite used.
- aubergine18
- level2
- Posts: 231
- Joined: Sun Jul 05, 2015 3:24 pm
Re: RenderPostOffset
Well, the offset number is choosing the depth of whatever the second sprite is.
What I was meaning is that if you use RenderPreOffset that means 'take the sprite index directly before the index of the sprite referenced in materials.txt' and RenderPostOffset is similar but taking the sprite index after the index of the one stated in materials.txt.
So, for dog crate:
Sprite DogCrate
RenderPostOffset 3
In objects.spritebank, DogCrate i = 87. **Post**Offset (after offset) means take the sprite with i = 89, which just happens to be DogCrateTop
The the value of the offset sets the z-index of the second sprite in relation to the RenderDepth of the main sprite.
EDIT: Ignore me, 87 + 1 = 88, not 89. So yeah, must be hard-coded as to what the second sprite is. *sigh*
EDIT2: Unless it keeps looking until it finds the next (PostOffset) or previous (PreOffset) sprite definition that has same dimensions as the main sprite?
What I was meaning is that if you use RenderPreOffset that means 'take the sprite index directly before the index of the sprite referenced in materials.txt' and RenderPostOffset is similar but taking the sprite index after the index of the one stated in materials.txt.
So, for dog crate:
Sprite DogCrate
RenderPostOffset 3
In objects.spritebank, DogCrate i = 87. **Post**Offset (after offset) means take the sprite with i = 89, which just happens to be DogCrateTop
The the value of the offset sets the z-index of the second sprite in relation to the RenderDepth of the main sprite.
EDIT: Ignore me, 87 + 1 = 88, not 89. So yeah, must be hard-coded as to what the second sprite is. *sigh*
EDIT2: Unless it keeps looking until it finds the next (PostOffset) or previous (PreOffset) sprite definition that has same dimensions as the main sprite?
Who is online
Users browsing this forum: No registered users and 29 guests