Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 11/7/17 10:05

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Adding lights to custom levels

Hi,

As anybody been able to add lights to custom levels?

I would like to add lighting like these (original game):
Oni%202017-07-11%2016-16-13-54.png
Oni%202017-07-11%2016-16-55-19.png
Oni%202017-07-11%2016-16-37-40.png

to my custom level. I'm using sketchup.

I've installed this sketchup plugin:
https://www.twilightrender.com/index.ph … s-twilight

But I couldn't get it to work.

Last edited by s10k (11/7/17 10:32)

Offline

#2 11/7/17 10:23

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: Adding lights to custom levels

Are you talking about adding lights like the ones in your screenshot, or adding lighting to a level?  Because the two have nothing to do with each other.  The lights are just 3D models with lens flare sprites attached, and the "lighting" is pre-baked vertex shading.


byproducts are fine, but where's the beef?

Offline

#3 11/7/17 10:29

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Its lights like in the screenshots. I'm sorry but I'm a completely newbie with this stuff.

Last edited by s10k (11/7/17 10:30)

Offline

#4 11/7/17 14:46

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Theoretically you could create OFGA files and use them with the Furniture.xml
Advantage: no need to set particle locations.
Disadvantage: nailing down the OFGA location isn't very comfortable.

Or you use the particle collection.
Disadvantage: Every time you move the light emitting objects, you also need to re-adjust the particle locations.
Advantage: the 3d objects can be easily moved in sketchup and the rotation of the lensflare doesn't matter as their orientation is always towards your screen.

If you can't find the original particles you want in the particle collection file, check also the ENVP section in the ONLV file.

Last edited by paradox-01 (11/7/17 15:03)

Offline

#5 11/7/17 15:17

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks paradox! This is exactly what I was looking for. I'm going to investigate more.

Offline

#6 17/6/18 8:39

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Hi everyone,

I just noticed this nice red lighting effect in neuro (in the wall and floor):

oni_red_light_effect.png

Is this "pre-baked vertex shading"? How can I add these to a custom level?

Offline

#7 17/6/18 9:15

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: Adding lights to custom levels

Yes, it's vertex shading (AKA vertex coloring).  See the section starting here for paradox's tutorial.


byproducts are fine, but where's the beef?

Offline

#8 17/6/18 10:30

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks!

I would add some of these effects to my custom level. There's specially one arena that would benefit so much from this technique.

Is there any way to add these effects without using XSI?

Maybe with XML?

Or could I use a different model and apply vertex coloring using script the command env_shade to it?

Maybe we can do it also on sketchup (not sure if it supports it)?

Offline

#9 17/6/18 11:12

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Might be that blender improved its buggy vertex shading code for DAE by now. https://blender.stackexchange.com/quest … tex-colors
Didn't test.

However, you would have to make sure that OniSplit reads that file.
If not, you have to adapt/repair the code. DAE is pretty much XML.

Offline

#10 17/6/18 11:21

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks paradox-01 I will have a look at this later. wink

Offline

#11 15/7/18 11:51

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Seems latest blender already supports saving the vertex color. Unfortunately I can't get it working with onisplit.

When export the dae file with the vertex color in blender and I try to convert it with oni split I always get this error:

Geometry 'SketchUp' does not contain texture coordinates.

Ignoring 2 degenerate polygons

Geometry 'SketchUp_001' does not contain texture coordinates.

System.IndexOutOfRangeException: ndice fora dos limites da matriz.

   em Oni.Dae.Source.ReadVector4(Source source, Int32 index)

   em Oni.Dae.Source.ReadColor(Source source, Int32 index)

   em Oni.Akira.AkiraDaeReader.ReadPolygonPrimitives(Node node, MeshPrimitives primitives, MaterialInstance materialInstance)

   em Oni.Akira.AkiraDaeReader.ReadGeometryInstance(Node node, GeometryInstance instance)

   em Oni.Akira.AkiraDaeReader.ReadNode(Node node)

   em Oni.Akira.AkiraDaeReader.ReadScene(Scene scene)

   em Oni.Level.LevelImporter.ImportModels(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.ReadModel(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.ReadLevel(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.Read(String filePath)

   em Oni.Level.LevelImporter.Import(String filePath, String outputDirPath)

   em Oni.Program.ImportLevel(String[] args)

   em Oni.Program.Execute(String[] args)

   em Oni.Program.Main(String[] args)

System.IndexOutOfRangeException: ndice fora dos limites da matriz. -> this translates to Index out bound on the matrix.

I also tried env_shade command and it works, but unfortunately it seems to apply all the color equally without any "lighting effect".

Last edited by s10k (15/7/18 11:53)

Offline

#12 15/7/18 12:45

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Alright, blender still sucks big_smile

From here on you would need to do .. what do they call it? Basic research?
Make a vertex-shaded cube in XSI.
Make a vertex-shaded cube in blender.
Compare the two DAE's XML code and write a program to transform your blender DAE files into a XSI-like DAE.

Edit: On a second thought you should test something else too: does the import work without vertex colors, when the DAE was simply re-saved in blender. That would give you a hint whether there's another problem.

env_shade
"If you use env_shade use it with caution. It completely overwrites the vertex coloring."
Ey, yes. All or nothing...

Last edited by paradox-01 (15/7/18 13:23)

Offline

#13 15/7/18 14:32

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

@paradox-01

Edit: On a second thought you should test something else too: does the import work without vertex colors, when the DAE was simply re-saved in blender. That would give you a hint whether there's another problem.

Yes it does! smile And it works perfectly in the game (at least the small part that I have imported).

From here on you would need to do .. what do they call it? Basic research?
Make a vertex-shaded cube in XSI.
Make a vertex-shaded cube in blender.
Compare the two DAE's XML code and write a program to transform your blender DAE files into a XSI-like DAE.

That's actually a good idea. There's a problem though, I can't run XSI for some reason (remember the weird problem that I had?).

Could you help me a bit with this one? Just do the XSI part, use this simple cube dae (3x3x3m cube) and apply a simple vertex shader and post it here. (just do this when you have some free time)

I will do the remaining, I will try to do that in Blender and compare both XML files.

Hopefully I can figure out where the vertex shade part is different, and create a patch file for XmlTools (to convert from Blender to XSI format).

If I can find what is different maybe we could later tell that to neo so he could also add support for vertex shader from blender on OniSplit.

Last edited by s10k (15/7/18 15:08)

Offline

#14 15/7/18 14:59

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Btw I just did the blender part:

added_red_vertex_shader_blender.png

File exported with blender:

cube333_from_sketchup_added_red_vertex_shader_blender.dae

Offline

#15 16/7/18 15:06

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

When I load that cube into XSI the vertex-colors were discarded.
The XML says it was made with 2.79.
The cube I colored yesterday in blender 2.8 still had vertex colors in XSI.
Question is: is that behavior due to the different blender versions or due to your cube's origin: Sketchup.
More, tomorrow.

Last edited by paradox-01 (16/7/18 15:10)

Offline

#16 17/7/18 16:45

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Okay blender 2.8 produces dae with vertex color that are compatible with XSI, but 2.79 does not. Although OniSplit processes both correctly.

When you open cube333 in XSI two triangles can't be colored. It gave me some WTH minutes. Turns out those two polys have flipped normals (facing inwards).
Anyway, you should fix incorrect normals otherwise in Oni you can see through these polygons (if not flagged "double sided").

Here are three cubes: http://paradox.oni2.net/ocf/tmp/

Offline

#17 18/7/18 14:12

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks a lot paradox-01!! I will have a look at these files soon! big_smile

Offline

#18 21/7/18 6:42

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

I tried convert all your dae files to oni using the command:

/red_vertex_cube_2.79.dae    DAE > AKEV ONI    -create:akev "C:/games/Oni/AE/Tools/VagoGUI/VagoWorkspace/Levels/DAE - AKEV ONI/" "C:/Users/home/Desktop/oni paradox/red_vertex_cube_2.79.dae"

But all of them give me out of bounds errors, this for oni split 0.9.96.0.

I shouldn't receive any error right?

Offline

#19 21/7/18 12:01

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

I made some test on a second machine. Looks like it works only for the 2.8 cube and for the 333 cube with OniSplit 99.

Last edited by paradox-01 (21/7/18 12:02)

Offline

#20 21/7/18 14:34

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

I still cannot get the command to work with any of these files (even with OniSplit 0.99, it displays the out of bounds errors).

Did the command change on OniSplit 0.99? Are you using the same as mine?

Offline

#21 21/7/18 15:29

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Try the alpha_helix.zip here:
http://paradox.oni2.net/ocf/tmp/
The "build level.bat" should not show any critical errors.

Offline

#22 21/7/18 16:22

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks! That works perfectly! The command that I tried was dae to akev.oni directly. Seems that one doesn't work.

I will now install blender 2.8 and do some experiments.

Offline

#23 22/7/18 10:33

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Ok so I installed blender 2.8 and I tried to apply the vertex shading effect and then I exported the level as dae and imported it with OniSplit 0.9.96 and it worked perfectly!

So at least with blender 2.8 I guess I could apply later some nice lighting effects to my custom level. smile

I couldn't get the textures to show up in blender and in oni after the export, but this may have something to do with the level being imported from a dae sketchup file. I didn't investigated more because I will only work on this later on.

Anyway to this to work we need to delete all the blender objects that its adds by default for a new level (lighting, camera etc), otherwise onisplit will complain about those.

For the lighting you can also delete it directly from the xml file deleting the <library_lights> node in the dae file generated by blender 2.8.

I like you idea of importing the blender dae files separately to the main level and this will probably be the way that I will do to add these nice shading effects (instead of applying them directly to the main level).

If I am successful in the future using these combinations (sketchup for all the level and blender to the vertex shading parts), I will make a video as tutorial for people who may need this later.

Anyway thanks again for all your support paradox, it has helped a lot!

Offline

Board footer

Powered by FluxBB