Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 776 777 [778] 779 780 ... 795

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 804706 times)

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11655 on: March 23, 2020, 06:52:36 am »

Cross-posting with sales thread:

https://365datascience.com/pricing/
Data-science courses all free until April 15th

mko

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11656 on: March 26, 2020, 04:02:40 am »

Well I did muck around with generating terrain in Unity.

Mind you this may be doing it the hard way, I didn't have a lot of reference when going into this:

Spoiler (click to show/hide)

Thanks again! I got info via PM that I can use it in my program (code considered by author to be in public domain due to simplicity). Just in case someone wants to do something similar - here it is slightly modified, to make it runnable. Stupid terrain generation code is included.

I release also all my work into public domain - if it was copyrightable at all.

Spoiler (click to show/hide)

Note "(y & 1)" appears to be unnecessary and introducing not needed(?) distortions. It appears that it can be safely removed.

April: assert added
« Last Edit: April 09, 2020, 03:29:35 am by mko »
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #11657 on: March 26, 2020, 12:52:11 pm »

So I'm a front end dev on a Drupal 7 site and I use this tool called SiteImprove for QA purposes. Today it flagged an HTTP 429 error on one of the links in the footer. I looked up the definition of the error but uh, I'm not really backend savvy so I have no idea what it means. There's people on the team who will diagnose the problem and fix it for me but they don't have time to break it down for me so I thought I'd ask about it here.

What the heck does this error 429 mean? What effect if any does this have on the user's experience? If this is a problem that can be fixed how do you fix it?

---

Also, anyone have any tips on getting up to speed on Angular and React really fast to impress some job interviewers next week? I'm trying to hone my front end development skills as prep. I'm fairly experienced with HTML and CSS but I mostly just edit existing styles, I don't have practice rolling my own or setting up a good architecture for a brand new site which is what I need to be able to do, and I don't have any web related scripting experience. I have good foundational skills with HLL so I think I could learn quick. To sum up, I just need resources for:
- General best practices for web scripting
- Best practices for JS?
- Quick start guides for Angular and React (ideally ones that you've actually used)
- Guidance on creating reusable and maintainable styles and markup for web
« Last Edit: March 26, 2020, 12:56:44 pm by Parsely »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11658 on: March 26, 2020, 01:01:34 pm »

Cross-posting with sales thread:

https://365datascience.com/pricing/
Data-science courses all free until April 15th

I know it's not really programming related, but this reminds me that I've really been considering getting a CCNA lately.  I feel like it would be one of the best ways to quickly get up to speed on some of the networking aspects of my web dev job that I don't really know a lot about, but I haven't taken the leap yet.  Apparently the study materials and test are a little pricey, and I'm not convinced it's the best way to actually learn the subject.
Logged
Through pain, I find wisdom.

mko

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11659 on: March 26, 2020, 01:14:33 pm »

So I'm a front end dev on a Drupal 7 site and I use this tool called SiteImprove for QA purposes. Today it flagged an HTTP 429 error on one of the links in the footer. I looked up the definition of the error but uh, I'm not really backend savvy so I have no idea what it means. There's people on the team who will diagnose the problem and fix it for me but they don't have time to break it down for me so I thought I'd ask about it here.

What the heck does this error 429 mean? What effect if any does this have on the user's experience? If this is a problem that can be fixed how do you fix it?

"I looked up the definition of the error but uh, I'm not really backend savvy so I have no idea what it means." - what was this definition?

From looking at https://duckduckgo.com/?q=http+error+429&t=canonical&ia=web that lead to https://httpstatuses.com/429 (that seemed reasonable)

"The user has sent too many requests in a given amount of time ("rate limiting")." - so either

429 was returned incorrectly

or

served refused to serve page because too many were requested. Limit may apply to specific IP / IP range / user / access token / etc.

Further steps depend on whatever it is your page or third part one and whatever it is supposed to be throttled.
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11660 on: March 26, 2020, 10:14:53 pm »

C# people who, unlike me, actually know what they're doing: what is the difference between Func<>, delegates and Actions? They all seem to accomplish very similar things (treating functions as objects) with varying degrees of convenience.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

mko

  • Bay Watcher
    • View Profile
Logged

mko

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11662 on: March 27, 2020, 06:25:39 pm »

Unity question time! I would appreciate hint whatever I am at least looking at the correct place. Or what is the term that I am looking for. I tried universal/ambient/scattered light none, seems to describe what I need.

Any idea how to create ambient light affecting scene that is fully dynamically generated? Currently I have a single directional light what means that front will be strongly lit and behind of an object will be 100% black.

Spoiler (click to show/hide)

I want object to be eliminated from all directions. Some directional light for shadows is necessary, but it is not working as a sole light.

Ambient light ( https://docs.unity3d.com/Manual/lighting-ambient-light.html ) sounds to be what I need, but according to https://docs.unity3d.com/Manual/lighting-window.html I should "Precompute the ambient light in the Editor, and then apply it at runtime.".

How I am supposed to do that when entire scene will be made by script?

I found window | rendering | lighting settings, and at least for now it is unclear to me what functions are doing. Random experimenting was not helpful.

I tried following reality where back of house is lit indirectly, by light reflected by all objects. So I bumped Environment | Environment reflections | Bounces to 2.

With no efffect whatsoever. Probably because light is not getting scattered ike in reality.

I found https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/global-illumination/ but I am not really understanding it, and anyway it is not clear whatever it would help with object that are created as program is running.

If it is necessary, then I will dig into shaders but I hope "add ambient directionless light" can be done in some simple way.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11663 on: March 27, 2020, 06:36:40 pm »

Quote
I should "Precompute the ambient light in the Editor, and then apply it at runtime.".

It doesn't actually say that.

What it says is this:

Quote
Ambient Mode    In the Built-in Render Pipeline, use this to specify which Global Illumination
mode should be used to determine ambient light in the Scene. This property is only available when both Realtime Global Illumination and Baked Global Illumination are enabled in the Scene.

   Realtime    Calculate and update ambient light in real-time, using Realtime Global Illumination (deprecated).
   Baked    Precompute the ambient light in the Editor, and then apply it at runtime.

What this means if that if you select the Realtime mode then ambient lighting is calculated on the fly, whereas if you select the Baked mode, ambient lighting is pre-calculated in the editor. Baked mode is less CPU intensive during playback.

What this actually means is that you can change the level of ambient lighting in realtime if you select Realtime mode but you can't change it once the game is running if you select Baked. So if you wanted to use Ambient light to simulate a day/night cycle, you wouldn't select Ambient Lighting / Baked mode.

Ambient lighting is just a general boost to brightness of everything on the screen. There's no source or direction associated with it. It's like raising the gamma value on your monitor. If you need very dark areas, then you can't use ambient scene lighting, since they won't be black, they'll be boosted to some shade of grey.
« Last Edit: March 27, 2020, 06:40:20 pm by Reelya »
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11664 on: March 27, 2020, 06:39:54 pm »

Looks like you already have some ambient light, though. Otherwise the shadows would be full black.

These are the different types of lighting:



Your main problem is the strong highlight in front and the darkness in the back, right? In which case try either decreasing the specular lighting component of the material or decreasing its shininess value.

NOTE: For more information: Ambient light is light that is constant across the whole object. Diffuse light depends on how far apart the normal vector and the light vector are -- it depends on position and arrangement of the object, but not on camera position. Specular light depends on how far apart the view vector and the reflection vector are -- it depends on the arrangement of the object and the camera arrangement. Each of these kinds of light have a coefficient that determines how much weight they have (the coefficient is the product of the corresponding coefficient of the material and coefficient of the light source), and specular light additionally is affected by the "shininess" value of the material.
« Last Edit: March 27, 2020, 06:49:20 pm by bloop_bleep »
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

mko

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11665 on: March 27, 2020, 07:59:12 pm »

Ambient lighting is just a general boost to brightness of everything on the screen. There's no source or direction associated with it. It's like raising the gamma value on your monitor. If you need very dark areas, then you can't use ambient scene lighting, since they won't be black, they'll be boosted to some shade of grey.
So I definitely want ambient lights. Maybe I will want to add truly black areas, but in  far future. For now ambient should be sufficient.

I will retry adding realtime ambient light. (EDIT: I failed - for now) (EDIT2: solved, problem was caused by Unity Skybox having insanely low max intensity value - switching to Source: color helped) (EDIT3 - lighting of my mesh is still broken, but that requires new debugging session - flat sections are not actually flat somehow - broken normals or something)

Looks like you already have some ambient light, though. Otherwise the shadows would be full black.
No, that is done with reduction of "strength" property in "realtime shadow" section of light settings. It reduces strength of shadows, but back side of objects is still 100% dark.

Here it is with shadow strength set to 100%. Thanks for pointing it out, it was highly confusing here. I should reset it to default before posting here as it obscures situation.



These are the different types of lighting:


Ooo, great find! I was unaware that ambient and diffuse is a separate thing.

Your main problem is the strong highlight in front and the darkness in the back, right? In which case try either decreasing the specular lighting component of the material or decreasing its shininess value.
I will look at it, but by this terminology I have diffuse, with distance set to infinity. ("directional" in unity terminology) https://docs.unity3d.com/Manual/Lighting.html

Specular-like display seems to be caused by diffuse directional light shining on a sphere, as cuboids are without that effect.



NOTE: For more information: Ambient light is light that is constant across the whole object. Diffuse light depends on how far apart the normal vector and the light vector are -- it depends on position and arrangement of the object, but not on camera position. Specular light depends on how far apart the view vector and the reflection vector are -- it depends on the arrangement of the object and the camera arrangement. Each of these kinds of light have a coefficient that determines how much weight they have (the coefficient is the product of the corresponding coefficient of the material and coefficient of the light source), and specular light additionally is affected by the "shininess" value of the material.
So I want to add ambient and currently have special case of diffuse (infinite distance).
« Last Edit: March 27, 2020, 08:52:33 pm by mko »
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11666 on: March 27, 2020, 08:57:29 pm »

Uh, I may be wrong, but I'm pretty sure shadow strength only acts as an additional multiplier on ambient light, specifically in the case of shadows. The only available light is ambient, diffuse, specular in most systems, and diffuse and specular lighting arises from light coming directly from a light source, so in shadows there is no diffuse or specular light -- therefore the only light in shadows is ambient light. You can see that in my diagram there. In diffuse and specular sections the left face is black, since it is shadowed, and in the final product the color of the left face is equal to the ambient color on the far left.

It's possible that your system uses an unusual fourth component specifically for shadows, I'm not sure, I'm not familiar with Unity.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

mko

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11667 on: March 27, 2020, 09:15:36 pm »

It's possible that your system uses an unusual fourth component specifically for shadows, I'm not sure, I'm not familiar with Unity.
Apparently Unity is special here.

https://docs.unity3d.com/Manual/class-Light.html section Shadows, Realtime Shadows part, Strength property "Use the slider to control how dark the shadows cast by this Light are, represented by a value between 0 and 1. This is set to 1 by default."
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11668 on: March 27, 2020, 10:08:13 pm »

It's possible that your system uses an unusual fourth component specifically for shadows, I'm not sure, I'm not familiar with Unity.
Apparently Unity is special here.

https://docs.unity3d.com/Manual/class-Light.html section Shadows, Realtime Shadows part, Strength property "Use the slider to control how dark the shadows cast by this Light are, represented by a value between 0 and 1. This is set to 1 by default."

Huh. Interesting.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11669 on: March 27, 2020, 10:24:45 pm »

That line is ambiguous however.

I'm pretty sure that what they mean by "how dark the shadow is" just means what percentage of the diffuse light is blocked by objects.

"1" is the default, and it means 100% of the diffuse light from that source is blocked. "0" is the lowest and probably means that no light at all is blocked. So if you leave it at "1" then any objects totally in shadow still have the ambient lighting level, but as you lower the "strength" of the shadow a higher proportion of diffuse light shines through.
« Last Edit: March 27, 2020, 10:27:18 pm by Reelya »
Logged
Pages: 1 ... 776 777 [778] 779 780 ... 795