« [Windows] Writing a C++ plugin
[Blender] Lighting up buildings' windows

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,143
[Blender] Lighting up buildings' windows
«  »Last edited

Just like R* did ?!
(click to show/hide)

Lately, I've been spending my time lighting up buildings for my server's map, because it was too dark.
(check the last seconds of the video to see what I'm talking about)

I recorded a video tutorial about it, maybe it will help some of you.

(click to show/hide)
Editing the textures in order to keep the windows only, and remove everything else, was cut from the full video.
It is something you can achieve through other softwares too - but I shown you the very basic way instead.


(click to show/hide)
Editing the textures is up to you and your skills.

Im gonna use a way that's basic and everyone can do.
For this, we gonna need TXD Workshop and  TXD Magic we already have.

This 222.txd is mine for such things. As you can see, this is howfinal products should look.
(so we remove everything and leave just what we wanna see lighted up in the darkness)

So, first, I'm gonna light up the textures.
I'm using PHOTOSCAPE because it is an easy software.

Now, here comes the "trick". We must create a copy of those textures, and edit them.
(but before, add "_lighted" sufix to your textures' names, so they don't conflict with the originals)

We gonna use the "alpha way". So, in the copies we created, we gonna paint with white everything we wanna keep visible in-game, and with black everything we wanna hide.

In order to make it look realistic, we should hide one/two windows, as rarely buildings have all lights opened.
(better to start with that idea - I just remembered now to tell you)

Ok, so we have done the first one; we move to the second one.

Also finished the second one. As I said, we make white just what we want to keep visible.

OH! totally forgot.
The black'n'white textures must be in .BMP format.
(we don't need .png for them anymore, so we delete them)

Now, comes the TXD Workshop trick. That software allows us to set an alpha variant for our texture.
( TXD Magic doesn't )

As you can see, both images mixed into one, and only the white part was kept visible.
So, we just open it now with TXD Magic. It reads it as a .png with transparency.
That's what we need.

So, all that matters is the result:
texture with transparency!


https://youtu.be/GQ-BZW1rE-M


https://youtu.be/6lZpSma5zlc

(click to show/hide)
Hello there!

Today I will show you my way of lighting up
buildings' windows !


--------------------
LONG STORY-SHORT
--------------------

In order to light them up, we will edit the original
object and remove everything else except windows.
Then, move the windows out of the building a bit, so
they won't interfere with each other. (nor with the LOD)
3rd step is to light them up through Blender.

--------------------
EXAMPLE
--------------------


Used:     MEd ( to export the object )
   Blender ( to edit the object ) with I/O DFF plugin!
   .TXD Magic ( to deal with .txd files )
   7zip ( to archive in .7z the files for vcmp )

__1st STEP_____________
We are going to export the object we wanna light up.
(using MEd)

__2nd STEP_____________
Once we got the .dff and .txd files, we can export the
needed textures out of the .txd (as .PNG)
(as I said, we need only the windows, so we will get rid of
the rest of the object, later)

The easiest and fastest way is to guess what textures
you need, by looking at the object itself and the .txd file.
(so you extract the textures you see)

__3rd STEP_____________
We take every texture apart and edit it.
(lighting up, cutting)
All we care about are the windows, so that's all we gonna
keep.
Ok, I did that in the pause, so here is the result.
(but I also kept the lighted up .png textures, because
Blender won't load textures with transparency)
((renamed the .dff and .txd as we don't need conflicts))

__4th STEP_____________
Load the object in Blender.
((
as we can see, there is no texture loaded.
Why ? because we also renamed the original textured.
We added the sufix "_lighted" so the model can't recognize it

We must set them, so we gonna look in the list of textures of
the model, and find our textures' names.

We found them, so now we have to remove everything else.
))

Now we need to select the faces we want to keep (windows part)
(( we select them with right-click and do multiple selection
by keeping SHIFT pressed down ))

Then separate them from the rest which we will delete later.
(( press 'space' key and write 'separate'.
Now, we have 2 objects. We can remove the other one
and keep the one we just created.
We can also remove anything else like collisions.
Those faces are all that matter ))

After that, we move the faces a bit.
(since we gonna spawn the new object in the same position
as our target object, we don't want them to interfere.
Just like R* did - see the image >no image< )


When we done with that, we must replace the textures with
the ones with more light on.
^ we already did that, earlier.

((
We must now paint the 'Vertex' of the object in bright white
otherwise, the object won't be bright.
they are lighted windows afterall; they must be as visible
as posible.
))

Then, we export the .dff
(( if you get such error, then there are some textures
registered but not used, with no textures, or something like
that. We just remove them ))


Done. The export gave no errors anymore.

__5th STEP_____________
We archive the .dff and .txd into an .7z with sufix "_unp"
(like "myname_unp.7z") and place it inside store directory.
Then we register the object inside store/objects/...here
(( use flag 8 for objects with transparency ))
And create a static object inside store/maps/...here

Now, since we did everything, we can join the server and
see our work ;p

Registering the object in store/objects/...here
Code: [Select]
<object id="0">
<flags value="8"/>
<collision type="none"/>
<texture path="night_windows.txd"/>
<model path="wshbuildws20_nt.dff" distance="1000" />
<time on="20" off="5"/>
</object>

Spawning the object as a static one, via .xml, in store/maps/...here
Code: [Select]
<item model="6000" name="wshbuildws20_nt">
<position x="-39.41270447" y="-1106.622192" z="14.09233856" />
<rotation format="axisangle" x="0" y="0" z="0.7071067691" angle="0.7071067691" />
</item>


KrOoB_

  • Full Member
  • Keeper
  • Posts: 175

|-> VC:MP Player Since 2014
|-> VC-TR Founder
|-> VC-TR Scripter and Hoster


SHy^

  • Jr. Member
  • Don't dare to mess
  • Posts: 94

habi

  • Sr. Member
  • Posts: 288
[Blender] Re: Lighting up buildings' windows
« Reply #3,  »
great work. couldn't see the buildings properly, before that you finished the video

Athanatos

  • Hero Member
  • Posts: 979
[Blender] Re: Lighting up buildings' windows
« Reply #4,  »
Custom HLSL shaders in VC:MP when? I want my RTX or my specular lightning models in muh server 11/10 /s

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,143
[Blender] Re: Lighting up buildings' windows
« Reply #5,  »
First post, updated!

I've included (in spoilers) the notepad texts I had, and also the code in XMLs.
As soon as Thijn's Uploader will let me upload files again, I will provide the "example_unp.7z" too, which includes the .txd and .dff.

rww

  • VC:MP Beta Tester
  • LU-DM Team
  • Posts: 405

Join to LU-DM Team Discord: https://discord.gg/PFwem6J

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,143

rww

  • VC:MP Beta Tester
  • LU-DM Team
  • Posts: 405
[Blender] Re: Lighting up buildings' windows
« Reply #8,  »Last edited
Quote from Sebastian on July 19th, 2020, 10:07 PM
Quote from rww on July 19th, 2020, 08:16 PM
with your skills, soon "GTA Romania" :D
Phahaha ;D
I was actually oscilating between romanian server ( Mamaia Vice)  and english one (TLRP) ,  in the begining
(Small bump) I don't have a time for it, but...

(click to show/hide)





(Yeah, textures needs some fixes, but I too lazy to fix it ;x)

Maybe it's time to do a own town in GTA :D

Join to LU-DM Team Discord: https://discord.gg/PFwem6J

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,143