Board index FlightGear Development Nasal

Changing model textures

Nasal is the scripting language of FlightGear.

Re: Changing model textures

Postby Hooray » Wed Dec 09, 2020 11:10 pm

If possible, the sourceforge approach (merge request) is generally preferred and stands a much better chance of being handled/discussed in a timely fashion
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Changing model textures

Postby gordonshamway23 » Thu Dec 10, 2020 9:50 pm

Merge request is online, let's see what it brings.

https://sourceforge.net/p/flightgear/flightgear/merge-requests/233/
gordonshamway23
 
Posts: 24
Joined: Sun Nov 22, 2020 8:15 pm

Re: Changing model textures

Postby wlbragg » Thu Dec 10, 2020 10:30 pm

Nice, thank you for your effort.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Changing model textures

Postby Hooray » Thu Dec 10, 2020 11:42 pm

Thanks. That's looking really good.

BTW: if you should happen to have a minute or two, and given that you seem to have a knack for the whole Nasal/Canvas thing, and especially for "projections", you might want to take a look at another long-standing feature request (for which there is already code, it just isn't integrated with Canvas::Map projection handling): http://wiki.flightgear.org/Canvas_Devel ... rojections

(you can easily repro the issue by opening EQUIPMENT/MAP (Canvas) while crossing the poles using the ufo)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Changing model textures

Postby FranzyG35 » Fri Dec 11, 2020 11:58 am

Hi Gordon,

Thank you so much for your solving these questions.
I'm very impressed by your so fast and efficient action.

Here is the last version of my demo - it's exactly what I wanted to achieve, :D
[link]https://drive.google.com/file/d/1OoOKO0Rq_9CaeTrP1y-cMhqtDmRGhkJT/view?usp=sharing[/link]
as a part of another hobby project.

Thank you Hooray, and wlbragg for your posts and help.

Have a nice week end.

Franck
FranzyG35
 
Posts: 15
Joined: Wed Nov 16, 2016 11:09 pm

Re: Changing model textures

Postby Hooray » Fri Dec 11, 2020 12:36 pm

Indeed, Gordon was very fast to respond here :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Changing model textures

Postby gordonshamway23 » Fri Dec 11, 2020 7:45 pm

Thank you all for your appreciation, I had fun solving it. So definetly a win win situation. :D
Hope it is good enough for being merged in the official flightgear repo.

@FranzyG35: As far as I have seen in your latest demo you took our advices. Did you already used my repo with the fix for testing it?


BTW: if you should happen to have a minute or two, and given that you seem to have a knack for the whole Nasal/Canvas thing, and especially for "projections", you might want to take a look at another long-standing feature request (for which there is already code, it just isn't integrated with Canvas::Map projection handling):
...


@Hooray: I will take a look at the problem for sure. I don't know if I am able to solve it, but I will try.

Wish you all a relaxing weekend.
gordonshamway23
 
Posts: 24
Joined: Sun Nov 22, 2020 8:15 pm

Re: Changing model textures

Postby FranzyG35 » Sun Dec 13, 2020 5:58 pm

Hi guys,

I said everything was as I wished in 2D. (with your modifications and my last demo)
- Now in 3D it is a bit different : take a look at the model attached below (rename the previous one in ...2D, and call it plaque.ac) and you'll notice that the textures - the top ones known as mySurface- do not change as they do with the 2D version. (did you test the possibility to color a group of surfaces )
- I tried to have the plaque.ac directly included in trigger.xml (not in a plaque.xml file) and the models don't show at all - is it normal ?
- How did you validate the fact the nasal in plaque.xml (nasal/load section) was executed and was cmdarg() correct then (refering to model section of the property tree)

Please let me know if I missed something or if you see the same results on your side.


Code: Select all
AC3Db
MATERIAL "mat 0 Rouge" rgb 1.000 0.000 0.000  amb 0.800 0.800 0.800  emis 0.000 0.000 0.000  spec 0.500 0.500 0.500  shi 64 trans 0.000
MATERIAL "mat 1 Rose" rgb 0.000 0.120 .230  amb 1.000 0.400 0.400  emis 0.000 0.000 0.000  spec 0.200 0.200 0.200  shi 64 trans 0.000
MATERIAL "empty-set at runtime" rgb 0.000 0.000 0.000  amb 0.800 0.800 0.800  emis 0.000 0.000 0.000  spec 0.200 0.200 0.200  shi 64 trans 0.000
OBJECT world
name "Blender_exporter_v3.0__plan.ac"
kids 2
OBJECT poly
name "mySurface"
data 5
texture "TexturesPlando/violet.png"
texrep 1 1
crease 40.0
numvert 4
-2.66423 0 2.35963
2.66423 0 2.35963
-2.66423 0 -2.35963
2.66423 0 -2.35963
numsurf 1
SURF 0X0
mat 2
refs 4
0 0 0
1 1 0
3 1 1
2 0 1
kids 0
OBJECT poly
name "Sides"
data 9
texture "TexturesPlando/rose.png"
texrep 1 1
crease 45.0
numvert 8
-2.66423 0 2.35963
2.66423 0 2.35963
-2.66423 0 -2.35963
2.66423 0 -2.35963
-2.66423 -30 2.35963
2.66423 -30 2.35963
-2.66423 -30 -2.35963
2.66423 -30 -2.35963
numsurf 4
SURF 0X10
mat 1
refs 4
1 0 0
5 1 0
7 1 1
3 0 1
SURF 0X10
mat 1
refs 4
3 0 0
7 1 0
6 1 1
2 0 1
SURF 0X10
mat 1
refs 4
2 0 0
6 1 0
4 1 1
0 0 1
SURF 0X10
mat 1
refs 4
0 0 0
4 1 0
5 1 1
1 0 1
kids 0
FranzyG35
 
Posts: 15
Joined: Wed Nov 16, 2016 11:09 pm

Re: Changing model textures

Postby gordonshamway23 » Mon Dec 14, 2020 9:29 pm

Looks like, I am getting the same results like you.
Currently investigating the problem, I will inform you as soon as there are news.
gordonshamway23
 
Posts: 24
Joined: Sun Nov 22, 2020 8:15 pm

Re: Changing model textures

Postby gordonshamway23 » Mon Dec 14, 2020 10:22 pm

Ok, first I found some problems in your ac file.

Code: Select all
OBJECT poly
name "mySurface"
data 5
Plane <--- here the parser expects 5 characters, because of the "data 5" line before, for example "Plane", like in your plaque2D.ac
texture "TexturesPlando/violet.png"


I suggest to delete the lines with data ..., as there are not required. Because of the missing 5 characters, the texture in the next line was ignored and not set for your object.
Did you edit the ac yourself? Or is the ac exported by blender? If so, your blender ac exporter must have a bug.

Also the materials maybe have some unfavorable values. For testing I would set a pure white, so one can see the texture without color modulation. But this does not cause a problem.

Concerning your cmdarg() problem, I still testing.
What are you expecting cmdarg() to hold, if I may ask?

Your corrected model:

Code: Select all
AC3Db
MATERIAL "mat 0 Rouge" rgb 1.000 0.000 0.000  amb 0.800 0.800 0.800  emis 0.000 0.000 0.000  spec 0.500 0.500 0.500  shi 64 trans 0.000
MATERIAL "mat 1 Rose" rgb 0.000 0.120 .230  amb 1.000 0.400 0.400  emis 0.000 0.000 0.000  spec 0.200 0.200 0.200  shi 64 trans 0.000
MATERIAL "empty-set at runtime" rgb 0.000 0.000 0.000  amb 0.800 0.800 0.800  emis 0.000 0.000 0.000  spec 0.200 0.200 0.200  shi 64 trans 0.000
OBJECT world
name "Blender_exporter_v3.0__plan.ac"
kids 2
OBJECT poly
name "mySurface"
texture "TexturesPlando/violet.png"
texrep 1 1
crease 40.0
numvert 4
-2.66423 0 2.35963
2.66423 0 2.35963
-2.66423 0 -2.35963
2.66423 0 -2.35963
numsurf 1
SURF 0X0
mat 2
refs 4
0 0 0
1 1 0
3 1 1
2 0 1
kids 0
OBJECT poly
name "Sides"
texture "TexturesPlando/rose.png"
texrep 1 1
crease 45.0
numvert 8
-2.66423 0 2.35963
2.66423 0 2.35963
-2.66423 0 -2.35963
2.66423 0 -2.35963
-2.66423 -30 2.35963
2.66423 -30 2.35963
-2.66423 -30 -2.35963
2.66423 -30 -2.35963
numsurf 4
SURF 0X10
mat 1
refs 4
1 0 0
5 1 0
7 1 1
3 0 1
SURF 0X10
mat 1
refs 4
3 0 0
7 1 0
6 1 1
2 0 1
SURF 0X10
mat 1
refs 4
2 0 0
6 1 0
4 1 1
0 0 1
SURF 0X10
mat 1
refs 4
0 0 0
4 1 0
5 1 1
1 0 1
kids 0


Concerning
- I tried to have the plaque.ac directly included in trigger.xml (not in a plaque.xml file) and the models don't show at all - is it normal ?

I tested that case, models are shown, but the loaded property is not set, and therefore the canvas is not placed. I will try to find a reason for that.
gordonshamway23
 
Posts: 24
Joined: Sun Nov 22, 2020 8:15 pm

Re: Changing model textures

Postby FranzyG35 » Fri Mar 05, 2021 2:30 am

Hi everyone !

Please find the links to my development using the great patch, Gordon provided us.
It shows in colors and text the improvement the patch gives !

The project's goal is to modelize dam ruptures on any existing or projected dams in the world (nothing less !)
and their consequences on any infrastructures including nuclear plants, chemical industries or your own home...

Installation should be easy : unzip the file :
https://drive.google.com/file/d/1UZkh8sMYczZ5wpu6N5b0QRykcENyhCcU/view?usp=sharing
and copy the 0Barrage directory in your FGDATA/Models.
Install the e000n40 scenery area.
Then modify the [/fgdata/Scenery/]Objects/e000n40/e002n45/2990553.stg file adding the line :

Code: Select all
OBJECT_STATIC Models/0Barrage/barrage.xml  2.497737370188425 45.41365006605746 420.00 240 0 -2


or override it with the 2990553.stg :
https://drive.google.com/file/d/1YR81Io1iE-hfRkEraNp06IpWBLkRdJPc/view?usp=sharing

Start flightgear in any helicopter (Gazelle or Bo105 will do) in LFCU heading east to the lake then turn right, to the dam.
Find a convenient location to witness the event that you will start by clicking the dam. :twisted:

You may also start flightgear at --lon=2.512357 --lat=45.410623 --altitude=1904 and lift off for a panoramic view before clicking.

Changing for another dam should be only a matter of adding a line in your own dam location .stg file with the dam coordinates, as well as reporting them as parameters in the barrage.nas file (lat lon alt and heading + capacity at lines 1545/1579 for examples) !
You'll see the dramatic effect your nearby old, ill maintained, privatized dam might have on your life one of these days !

Some tweeking is possible/needed - but I could not manage to make options available by menu by now.
Many options and features are available although many are not enabled/operational.
I will welcome any questions, ideas, help or comments as long as they are not to rewrite the whole thing from scratch under whatever workframe...
I put lots of comments in the code including my questions, doubts and todos - Feel free to help answer these questions.

Enjoy
Last edited by FranzyG35 on Sat Mar 06, 2021 7:17 pm, edited 1 time in total.
FranzyG35
 
Posts: 15
Joined: Wed Nov 16, 2016 11:09 pm

Re: Changing model textures

Postby wlbragg » Fri Mar 05, 2021 8:21 am

Nicely done! Add some better texture and modeling of the water and, that would be impressive! Not that it isn't good as is. But some more realistic water would be icing on the cake.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Changing model textures

Postby wlbragg » Sun Mar 07, 2021 5:41 pm

Something that would make this more user friendly and allow for extensibility, would be to change it to an Addon instead of brute force placing it in the fgdata structure. It's not the "best" design to do it in fgdata. It would be way better to have it an Addon.

See: https://wiki.flightgear.org/Addon

There are several addons you can examine for help and examples. I did the CargoTowingAddon and I think it has virtually every concept incorporated in it that you need for your project. I also modeled the format of my addon off of the RedGriffinATC addon which I thought did a really nice job with the organizational structure and format of that addon.

It'll leave room for growth and also make updating easier for everyone including yourself. It also keeps it out of fgdata which many less experienced users really shouldn't be messing around in.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Changing model textures

Postby gabrielalexm » Mon Mar 22, 2021 10:39 pm

I installed it and I get the Barrage dialog when FG starts. I see red arrow pointing down to the dam and the dam appears clickable. However, nothing happens when I click on it. I'm using a Mac. Does that matter? Also, the scenery was downloaded automatically by TerraSync, so it is in a different location. I modified the stg file in the TerraSync directory. I'm using FG 2020.3.6. I don't know if any of this matters. If you have an idea of something I could try to make it work, I'd appreciate it.
gabrielalexm
 
Posts: 6
Joined: Fri Mar 19, 2021 11:09 pm

Re: Changing model textures

Postby wkitty42 » Mon Mar 22, 2021 10:47 pm

gabrielalexm wrote in Mon Mar 22, 2021 10:39 pm:I modified the stg file in the TerraSync directory.

don't do that... terrasync will replace it since it doesn't match what is on the servers...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

PreviousNext

Return to Nasal

Who is online

Users browsing this forum: No registered users and 6 guests