zBase (32bpp base set by Zephyris)

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

Michi_cc wrote:A flat ground tile at normal zoom has 64 pixels across and 31 pixels from top to bottom. A raised/lowered corner has an offset of +/- 8 pixels compared to the flat corner.
That suggests 8*(2^0.5)/(32*2)=0.1767, which is actually slightly too short... Anyway I have remade the temperate terrain tiles with a corner height of 0.2 (reduced from 0.25) which I think should work better. These are in the repo for testing anyway.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

Nailed the maths :) Camera angle is 30 degrees, tile width from the camera POV is 2^0.5, slope height relative to tile width is 1/8th, therefore 3D slope height is (2^0.5)/(8*cos(30)=0.204156

I will update all the terrain sprites, it would be cool to see them coded to check I have done all the calculations right!
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Michi_cc »

Zephyris wrote:Camera angle is 30 degrees
Sure about that? The pixel sprites use a two pixels left, one up approach, which would result in an angle of 26.565°. But of course, if the result works, then it works :)

-- Michael Lutz
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

Michi_cc wrote: Sure about that? The pixel sprites use a two pixels left, one up approach, which would result in an angle of 26.565°. But of course, if the result works, then it works :)
It messes with your brain trying to work it out :D The diagonal 2px along/1px up line lies at atan(1/2)=26.565 deg from horizontal, but that's not the same angle the 3D camera should look at the scene. It took me a long time (and some trial and error!) to work that the camera needs to be looking down at 30 degrees to give that result.

I hate geometry :s
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by GeekToo »

Zephyris wrote:
Michi_cc wrote: Sure about that? The pixel sprites use a two pixels left, one up approach, which would result in an angle of 26.565°. But of course, if the result works, then it works :)
It messes with your brain trying to work it out :D The diagonal 2px along/1px up line lies at atan(1/2)=26.565 deg from horizontal, but that's not the same angle the 3D camera should look at the scene. It took me a long time (and some trial and error!) to work that the camera needs to be looking down at 30 degrees to give that result.

I hate geometry :s
Zephyris is right, Michi_cc too (kind of) but for the wrong view. The 26,56° is the angle between game x and y axis in the resulting plane. Ratio x:y = 2:1, which means an angle of arctan(0,5) = 26,56°. But that is not what Zephyris wanted, he wants the angle to rotate the groundplane (or camera angle whatever you want) so in the view plane y of tile is half the x. So seen from the side, perpendicular to the camera and ground plane the question was: how much to rotate the ground tile so the y is half its full size. We know the tile is square, so to obtain half the y, we need to rotate the tile so sin(alpha) is 0,5 (alpha measured between line from cam to centre of ground plane and the line throuhg the ground tile). Then the answer is arcsin (0,5) = 30 degrees, or 60 degrees from vertical.
CargoLiner
Engineer
Engineer
Posts: 13
Joined: 12 Jul 2012 15:42

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by CargoLiner »

at times like this i would just do a screen grab and do a camera match
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

I'm having difficulties pushing some changes to the server;

I set up TortoiseHg (on Windows 7) according to this guide: http://dev.openttdcoop.org/attachments/ ... _0.9.0.pdf

I am trying to push quite a big change set (~100Mb) but TortoiseHg gives an URLError, this is the log:
% hg --repository M:\zbase\zbase push https://zephyris@push.openttdcoop.org/zbase
pushing to https://zephyris@push.openttdcoop.org/zbase
searching for changes
URLError: [Errno 10054] An existing connection was forcibly closed by the remote host
[command returned code 255 Mon Jul 23 07:52:47 2012]
zbase%
Does anyone know what this could be?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by planetmaker »

Zephyris wrote:I'm having difficulties pushing some changes to the server;(...)
I'm not 100% sure, but it might seem that it's the same or a similar problem that pulling big repositories via http fails currently

You could try to configure pushing the changeset via ssh (same path as you have configured for pull) in the hgrc

Code: Select all

[paths]
default = ssh://ottdc@mz.openttdcoop.org:22/hg-repos/zbase
default-push = ssh://ottdc@mz.openttdcoop.org:22/hg-repos/zbase
LeXa2
Engineer
Engineer
Posts: 87
Joined: 15 Jul 2012 03:54
Location: Moscow, Russian Federation

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by LeXa2 »

hg uses http post or web/dav (depending on server configuration) to send data from client to server. In case you're pushing something really big you might hit http connection time limit. I hadn't been ever using openttdcoop repos so I don't known for sure what the real limits there are, but you could try configuring your client to use ssh (like planetmaker advised) instead of http(s) and see if that helps.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

Cool, ill give that a go.
CargoLiner
Engineer
Engineer
Posts: 13
Joined: 12 Jul 2012 15:42

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by CargoLiner »

Zephyris

Just wondering why you do not use a Material ID pass to isolate company color mask
Image

although seeing as these are 8bit files without alpha a slightly better setup might be
Image

this was achieved by assigning the material CC_Normal a pass index of 1
Image
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

I certainly could do. The reason I didn't is because a plain colour pass is simpler and therefore more flexible when trying to return multiple 'special' colours; some objects have CC, some have a recolourable brown colour (bridges, some buildings), some have a recolourable green colour (grass on road and rail), etc. Blender can't produce 8bpp paletted render outputs anyway so some post-processing of the mask sprites will always be needed so the colour pass approach is essentially equivalent anyway.

If it completely fails it would be fairly easy to switch to a material index pass too though... Maybe I will work that into the render noodle now in case it proves useful!
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Xotic750 »

I am using a slightly different method for OpenGFX+ Trains.

I use a material index and compositor block in a similar fashion for the 1cc and 2cc but do not mix the background colour into it.

I set the material colour to a central value in the 8-bit colour range.

This produces 2 files with alpha in the correct 8-bit colour range.

This allows me to do a few post-processing tasks; making the 8-bit CC masks for 32bpp and also creating 8bpp sprites.

Using GIMP, I then convert each mask to a single colour using an index file, for example to get the 1cc mask for 32bpp I use, but you can change this to lighten or darken the sprite's CC colour.

Code: Select all

GIMP Palette
Name: ttd-newgrf-32cc1only
Columns: 16
#
 20  52 124	Index 200
Finally, I add 3 images together:

1. The backround colour (magic blue)
2. The 1cc image
3. The 2cc image

This gives me an 8-bit image mask for the 32bpp sprites, as shown below.



For the 8bpp sprites, I again use the 2 image files created in the compositor and the image without ground shadows (another compositor block, the shadows look awful in 8bpp within OpenTTD) and pass them through GIMP. This time I use a colour index file containing all the 8bpp cc colours

Code: Select all

GIMP Palette
Name: ttd-newgrf-cc1only
Columns: 16
#
  8  24  88	Index 198
 12  36 104	Index 199
 20  52 124	Index 200
 28  68 140	Index 201
 40  92 164	Index 202
 56 120 188	Index 203
 72 152 216	Index 204
100 172 224	Index 205

Now what I do here is that I take the sprite image, convert it to DOS indexed without any special colours (i.e. flashing colours etc), this does not give me a final image because the CC magic colours are not good after this process. So, I now take the converted masks and lay them upon this image and finally merge down.

This gives a nice 8bpp sprite with the correct cc colourings, as shown in my example below.

Yes, quite a bit of post-processing in GIMP and maybe too complex for some of the more structural sprites, but works great for vehicles. :)
Attachments
1cc and 2cc compositor node
1cc and 2cc compositor node
compositor_node.png (31.11 KiB) Viewed 5412 times
Material with index of 1 and colour
Material with index of 1 and colour
material_colour.png (66.57 KiB) Viewed 5412 times
8-bit mask for 32bpp sprites
8-bit mask for 32bpp sprites
0002_in4xm.png (1.29 KiB) Viewed 5412 times
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Xotic750 »

You can find all of this in the OpenGFX+ Trains repo, or PM me if you want any further info.
Attachments
8bpp sprite with the 2 masks overlayed in the correct cc colour indexes
8bpp sprite with the 2 masks overlayed in the correct cc colour indexes
0002_in4x.png (2.16 KiB) Viewed 5412 times
32bpp sprite with ground shadows
32bpp sprite with ground shadows
0002_in4x.png (10.85 KiB) Viewed 5412 times
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

planetmaker wrote:You could try to configure pushing the changeset via ssh (same path as you have configured for pull) in the hgrc
Just giving this a go, I assume I need to give my public key to someone...
CargoLiner
Engineer
Engineer
Posts: 13
Joined: 12 Jul 2012 15:42

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by CargoLiner »

would it not be possible to spit the V from a HSVA into a color ramp mapped to the CC index colors masked off to the Material Index (your probably going need to eye the spacing but it should still give decent enough results)
Image

Multiple special color mask can then be mix back to a single image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Alberth »

Is the road that deadly? ;)
deadly_road.png
deadly_road.png (166.85 KiB) Viewed 5330 times
Edit: For me the church roof is invisible, so the cross seems to float mid-road
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Lord Aro »

Need to adjust your monitor settings, i think ;)
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by planetmaker »

Alberth wrote:Is the road that deadly? ;)
Edit: For me the church roof is invisible, so the cross seems to float mid-road
Oh, I wondered first what you meant :-)
(I see the church roof: same colour but different brightnesses)
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: zBase (32bpp base set by Zephyris) - Coder needed!

Post by Zephyris »

Yeah, I haven't made a tiled roof texture yet :) I will work on that later.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 18 guests